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
))
24 for filename
in files
:
25 if filename
[-6:] == ".guide":
27 filehandle
.write(' @{" %s " LINK "HELP:English/%s/%s/MAIN"}\n' % (name
, section
, filename
))
28 filehandle
.write('@ENDNODE\n\n')
30 ###############################################################################
34 print "genindex helpdir " + helpdir
38 ("System", "SYS:System, SYS:Tools and SYS:Utilites"),
41 today
= datetime
.date
.today()
43 filehandle
= open(os
.path
.join(helpdir
, "Index.guide"), "w")
44 filehandle
.write("@DATABASE Index.guide\n\n")
45 filehandle
.write("@$VER: Index.guide 1.0 (%d.%d.%d)\n" % (today
.day
, today
.month
, today
.year
))
46 filehandle
.write("@(C) Copyright (C) %d, The AROS Development Team. All rights reserved.\n\n" % (today
.year
))
48 filehandle
.write('@NODE MAIN "Help sections"')
49 filehandle
.write('\n\n @{B}Section@{TAB}Location of Programs@{UB}\n\n')
50 for section
in sections
:
51 filehandle
.write(' @{" %s " LINK "%s"}@{TAB}%s\n' % (section
[0], section
[0], section
[1]))
52 filehandle
.write('@ENDNODE\n\n')
54 for section
in sections
:
55 write_section(helpdir
, filehandle
, section
[0])
60 if __name__
== "__main__":