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 ;-)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
diff --git a/docs/docmaker.py b/docs/docmaker.py
index 1560ad8..5a6ea0e 100644
--- a/docs/docmaker.py
+++ b/docs/docmaker.py
@@ -327,6 +327,33 @@ class DocContent:
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 @@ def dump_doc_contents( block_list ):
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 @@ def main(argv):
# 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