3
# DocMaker (c) 2002, 2004, 2008 David Turner <david@freetype.org>
5
# This program is a re-write of the original DocMaker took used
6
# to generate the API Reference of the FreeType font engine
7
# by converting in-source comments into structured HTML.
9
# This new version is capable of outputting XML data, as well
10
# as accepts more liberal formatting options.
12
# It also uses regular expression matching and substitution
13
# to speed things significantly.
19
from formatter import *
24
import sys, os, time, string, glob, getopt
28
print "\nDocMaker Usage information\n"
29
print " docmaker [options] file1 [file2 ...]\n"
30
print "using the following options:\n"
31
print " -h : print this page"
32
print " -t : set project title, as in '-t \"My Project\"'"
33
print " -o : set output directory, as in '-o mydir'"
34
print " -p : set documentation prefix, as in '-p ft2'"
36
print " --title : same as -t, as in '--title=\"My Project\"'"
37
print " --output : same as -o, as in '--output=mydir'"
38
print " --prefix : same as -p, as in '--prefix=ft2'"
42
"""main program loop"""
47
opts, args = getopt.getopt( sys.argv[1:], \
49
["help", "title=", "output=", "prefix="] )
50
except getopt.GetoptError:
60
project_title = "Project"
65
if opt[0] in ( "-h", "--help" ):
69
if opt[0] in ( "-t", "--title" ):
70
project_title = opt[1]
72
if opt[0] in ( "-o", "--output" ):
73
utils.output_dir = opt[1]
75
if opt[0] in ( "-p", "--prefix" ):
76
project_prefix = opt[1]
80
# create context and processor
81
source_processor = SourceProcessor()
82
content_processor = ContentProcessor()
84
# retrieve the list of files to process
85
file_list = make_file_list( args )
86
for filename in file_list:
87
source_processor.parse_file( filename )
88
content_processor.parse_sources( source_processor )
91
content_processor.finish()
93
formatter = HtmlFormatter( content_processor, project_title, project_prefix )
96
formatter.index_dump()
97
formatter.section_dump_all()
100
# if called from the command line
102
if __name__ == '__main__':