ref: b916b1e53fb4cc759ce64e4b0a8ad0f259c4f9ad
parent: a3b6c6c2906c04b73a80674b3f75c3e21e7f21c6
author: David Turner <david@freetype.org>
date: Wed May 31 03:54:45 EDT 2000
updated the DocMaker tool to produce HTML pages
There is still some work on it to allow the following:
- multiple input files
- block classification according to block's first markers
(e.g. types, functions, constants, etc..)
- indexing and cross-linking
- better layout ;-)
--- a/docs/docmaker.py
+++ b/docs/docmaker.py
@@ -327,7 +327,34 @@
if field: print "</field> "
-
+ def dump_html(self):
+ n = len(self.fields)
+ for i in range(n):
+ field = self.fields[i]
+ if field==[]:
+ print "<p>"
+ for paras in self.texts[i]:
+ print "<p>"
+ paras.dump()
+ print "</p>"
+ else:
+ if i==1:
+ print "<table cellpadding=4><tr valign=top><td>"
+ else:
+ print "</td></tr><tr valign=top><td>"
+
+ print "<b>"+field+"</b></td><td>"
+
+ for paras in self.texts[i]:
+ print "<p>"
+ paras.dump()
+ print "</p>"
+
+ print "</td></tr>"
+ if n > 1:
+ print "</table>"
+
+
######################################################################################
#
#
@@ -439,6 +466,36 @@
print "</marker>"
print "</block>"
+def dump_html_1( block_list ):
+
+ print "<html><body>"
+ types = [ 'Type', 'Struct', 'FuncType', 'Function', 'Constant', 'Enumeration' ]
+ for block in block_list:
+ docblock = DocBlock(block)
+ print "<hr>"
+ for i in range(len(docblock.markers)):
+ marker = docblock.markers[i]
+ content = docblock.contents[i]
+ dcontent = DocContent( content )
+
+ if marker=="Description":
+ print "<ul><p>"
+ dcontent.dump()
+ print "</p></ul>"
+
+ elif marker in types:
+ print "<h3><font color=blue>"+content[0]+"</font></h3>"
+ else:
+ print "<h4>"+marker+"</h4>"
+ print "<ul><p>"
+ dcontent.dump_html()
+ print "</p></ul>"
+
+ print ""
+
+ print "<hr></body></html>"
+
+
def main(argv):
"""main program loop"""
print "extracting comment blocks from sources .."
@@ -449,8 +506,10 @@
# dump_doc_blocks( list )
# print "dumping block contents .."
- dump_doc_contents(list)
+# dump_doc_contents(list)
+ dump_html_1(list)
+
# dump_single_content(list)
# If called from the command line
--
⑨