5 # Convert source code markup to HTML documentation.
7 # Copyright 2002, 2004, 2008, 2013, 2014 by
10 # This file is part of the FreeType project, and may only be used,
11 # modified, and distributed under the terms of the FreeType project
12 # license, LICENSE.TXT. By continuing to use, modify, or distribute
13 # this file you indicate that you have read the license and
14 # understand and accept it fully.
17 # This program is a re-write of the original DocMaker tool used to generate
18 # the API Reference of the FreeType font rendering engine by converting
19 # in-source comments into structured HTML.
21 # This new version is capable of outputting XML data as well as accepting
22 # more liberal formatting options. It also uses regular expression matching
23 # and substitution to speed up operation significantly.
29 from formatter
import *
34 import sys
, os
, time
, string
, glob
, getopt
38 print "\nDocMaker Usage information\n"
39 print " docmaker [options] file1 [file2 ...]\n"
40 print "using the following options:\n"
41 print " -h : print this page"
42 print " -t : set project title, as in '-t \"My Project\"'"
43 print " -o : set output directory, as in '-o mydir'"
44 print " -p : set documentation prefix, as in '-p ft2'"
46 print " --title : same as -t, as in '--title=\"My Project\"'"
47 print " --output : same as -o, as in '--output=mydir'"
48 print " --prefix : same as -p, as in '--prefix=ft2'"
52 """Main program loop."""
57 opts
, args
= getopt
.getopt( sys
.argv
[1:],
59 ["help", "title=", "output=", "prefix="] )
60 except getopt
.GetoptError
:
69 project_title
= "Project"
74 if opt
[0] in ( "-h", "--help" ):
78 if opt
[0] in ( "-t", "--title" ):
79 project_title
= opt
[1]
81 if opt
[0] in ( "-o", "--output" ):
82 utils
.output_dir
= opt
[1]
84 if opt
[0] in ( "-p", "--prefix" ):
85 project_prefix
= opt
[1]
89 # create context and processor
90 source_processor
= SourceProcessor()
91 content_processor
= ContentProcessor()
93 # retrieve the list of files to process
94 file_list
= make_file_list( args
)
95 for filename
in file_list
:
96 source_processor
.parse_file( filename
)
97 content_processor
.parse_sources( source_processor
)
100 content_processor
.finish()
102 formatter
= HtmlFormatter( content_processor
,
107 formatter
.index_dump()
108 formatter
.section_dump_all()
111 # if called from the command line
112 if __name__
== '__main__':