tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / workbench / locale / help / genindex.py
blob6d1eef7dbd9e7b663516404ec7be3683390024ab
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2013, The AROS Development Team. All rights reserved.
3 # $Id$
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
12 for help guides.
13 """
15 import os
16 import sys
17 import datetime
19 def write_section(helpdir, filehandle, section):
20 files = os.listdir(os.path.join(helpdir, section))
21 files.sort()
22 filehandle.write('@NODE %s %s\n' % (section, section))
23 filehandle.write('\n\n@{B}Section "%s"@{UB}\n\n' % (section))
24 for file in files:
25 if file[-6:] == ".guide":
26 name = file[:-6]
27 filehandle.write(' @{" %s " LINK "HELP:English/%s/%s/MAIN"}\n' % (name, section, file))
28 filehandle.write('@ENDNODE\n\n')
30 ###############################################################################
32 helpdir = sys.argv[1]
33 print "genindex helpdir " + helpdir
35 sections = (
36 ("Commands", "C:"),
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])
56 filehandle.close()