1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2013, The AROS Development Team. All rights reserved.
5 """Generate Index.guide.
7 Create index page from the help guide documents.
9 Usage: python genindex.py <helpdir>
11 <helpdir> Index.guide will be placed in that directory. Sub-directories will be scanned
19 def write_section(helpdir
, filehandle
, section
):
20 files
= os
.listdir(os
.path
.join(helpdir
, section
))
22 filehandle
.write('@NODE %s %s\n' % (section
, section
))
23 filehandle
.write('\n\n@{B}Section "%s"@{UB}\n\n' % (section
))
25 if file[-6:] == ".guide":
27 filehandle
.write(' @{" %s " LINK "HELP:English/%s/%s/MAIN"}\n' % (name
, section
, file))
28 filehandle
.write('@ENDNODE\n\n')
30 ###############################################################################
33 print "genindex helpdir " + helpdir
37 ("System", "SYS:System, SYS:Tools and SYS:Utilites"),
40 today
= datetime
.date
.today()
42 filehandle
= open(os
.path
.join(helpdir
, "Index.guide"), "w")
43 filehandle
.write("@DATABASE Index.guide\n\n")
44 filehandle
.write("@$VER: Index.guide 1.0 (%d.%d.%d)\n" % (today
.day
, today
.month
, today
.year
))
45 filehandle
.write("@(C) Copyright (C) %d, The AROS Development Team. All rights reserved.\n\n" % (today
.year
))
47 filehandle
.write('@NODE MAIN "Help sections"')
48 filehandle
.write('\n\n @{B}Section@{TAB}Location of Programs@{UB}\n\n')
49 for section
in sections
:
50 filehandle
.write(' @{" %s " LINK "%s"}@{TAB}%s\n' % (section
[0], section
[0], section
[1]))
51 filehandle
.write('@ENDNODE\n\n')
53 for section
in sections
:
54 write_section(helpdir
, filehandle
, section
[0])