# HG changeset patch # User Paul Boddie # Date 1341786179 -7200 # Node ID 6b450ab976136b9b96402d32f0299ba6344bbf8a # Parent a99e6bee4c515eb1feee5dd6136cadb2a20da1a5 Added module docstring output and improved constant support in value lists. diff -r a99e6bee4c51 -r 6b450ab97613 micropython/report.py --- a/micropython/report.py Sun Jul 08 21:13:39 2012 +0200 +++ b/micropython/report.py Mon Jul 09 00:22:59 2012 +0200 @@ -67,6 +67,7 @@ .specific-ref { color: #07F; } .str { color: #FF00FF; } .doc { color: #FF00FF; margin-top: 1em; margin-bottom: 1em; } + .doc.module { font-size: smaller; } .popup { display: none; @@ -246,12 +247,12 @@ def _keyword(self, kw, leading=0, trailing=1): self._reserved(kw, "keyword", leading, trailing) - def _doc(self, node): + def _doc(self, node, classes=None): if node.doc is not None: - self._docstring(node.doc) + self._docstring(node.doc, classes) - def _docstring(self, s): - self.stream.write("
")
+    def _docstring(self, s, classes=None):
+        self.stream.write("
" % (classes and " %s" % classes or ""))
         self.stream.write('"""')
         output = textwrap.dedent(s.replace('"""', '\\"\\"\\"'))
         self.stream.write(self._text(output))
@@ -379,12 +380,16 @@
 
         "Get the output form of the values referenced by 'attr'."
 
-        if isinstance(attr, Instance):
-            return [(str(attr), attr)]
+        if isinstance(attr, Const):
+            return [(str(attr.get_value()), attr)]
+        elif isinstance(attr, Instance):
+            return []
 
         values = []
         for v in attr.get_values():
-            if not isinstance(v, Instance):
+            if isinstance(v, Const):
+                values.append((str(v.get_value()), v))
+            elif not isinstance(v, Instance):
                 values.append((v.full_name(), v))
 
         values.sort()
@@ -620,6 +625,7 @@
         self.stream.write(html_footer)
 
     def visitModule(self, node):
+        self._doc(node, "module")
         self.default(node)
 
     # Statements.