[gobject-introspection] mallardwriter: Use the same code to lookup fundamentals as the rest



commit 9d1eb5f5c937d1bd687828ee897b7cd42e470571
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 30 09:50:43 2013 -0500

    mallardwriter: Use the same code to lookup fundamentals as the rest
    
    Also, put <code> blocks around fundamentals.

 giscanner/mallardwriter.py                         |    6 +++++-
 .../DocExamples.Obj.method.page                    |    6 +++---
 .../DocExamples.Obj.static_method.page             |    4 ++--
 .../DocExamples.Obj.method.page                    |    6 +++---
 .../DocExamples.Obj.static_method.page             |    4 ++--
 5 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py
index c4c88e9..74bb3d6 100644
--- a/giscanner/mallardwriter.py
+++ b/giscanner/mallardwriter.py
@@ -239,7 +239,11 @@ class MallardFormatter(object):
         return self.format_xref(type_)
 
     def _process_fundamental(self, node, match, props):
-        return self.fundamentals.get(props['fundamental'], match)
+        fundamental = props['fundamental']
+        try:
+            return '<code>%s</code>' % (self.fundamentals[fundamental],)
+        except KeyError:
+            return match
 
     def _process_parameter(self, node, match, props):
         try:
diff --git a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page
index 38e4f5a..1c52955 100644
--- a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page
+++ b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.method.page
@@ -62,11 +62,11 @@ created with <link xref="DocExamples.Obj.new">doc_examples_obj_new</link>.</p><p
 </tr>
 <tr>
 <td><p>boolean_arg :</p></td>
-<td><p>You should always pass TRUE.</p></td>
+<td><p>You should always pass <code>TRUE</code>.</p></td>
 </tr>
 <tr>
 <td><p>pointer_arg :</p></td>
-<td><p>If not NULL, do a thing. Pass <code>first_arg</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></td>
+<td><p>If not <code>NULL</code>, do a thing. Pass <code>first_arg</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></td>
 </tr>
 <tr>
 <td><p>string :</p></td>
@@ -74,7 +74,7 @@ created with <link xref="DocExamples.Obj.new">doc_examples_obj_new</link>.</p><p
 </tr>
 <tr>
 <td><p>Returns :</p></td>
-<td><p>Either FALSE or something FALSE-y.</p></td>
+<td><p>Either <code>FALSE</code> or something <code>FALSE</code>-y.</p></td>
 </tr>
 </table>
 <p>Since 0.99</p>
diff --git a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.static_method.page b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.static_method.page
index f5f2145..f0c917f 100644
--- a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.static_method.page
+++ b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.static_method.page
@@ -29,11 +29,11 @@ and a return value.</p>
 <table>
 <tr>
 <td><p>out_arg :</p></td>
-<td><p>a pointer to int, or NULL to ignore</p></td>
+<td><p>a pointer to int, or <code>NULL</code> to ignore</p></td>
 </tr>
 <tr>
 <td><p>Returns :</p></td>
-<td><p>TRUE if <code>out_arg</code> is valid, FALSE otherwise</p></td>
+<td><p><code>TRUE</code> if <code>out_arg</code> is valid, <code>FALSE</code> otherwise</p></td>
 </tr>
 </table>
 </page>
diff --git a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
index cd80570..3f51bf3 100644
--- a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
+++ b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
@@ -60,11 +60,11 @@ created with <link xref="DocExamples.Obj.new">Obj.new</link>.</p><p>This should
 </tr>
 <tr>
 <td><p>boolean_arg :</p></td>
-<td><p>You should always pass True.</p></td>
+<td><p>You should always pass <code>True</code>.</p></td>
 </tr>
 <tr>
 <td><p>pointer_arg :</p></td>
-<td><p>If not None, do a thing. Pass <code>self</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></td>
+<td><p>If not <code>None</code>, do a thing. Pass <code>self</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></td>
 </tr>
 <tr>
 <td><p>string :</p></td>
@@ -72,7 +72,7 @@ created with <link xref="DocExamples.Obj.new">Obj.new</link>.</p><p>This should
 </tr>
 <tr>
 <td><p>Returns :</p></td>
-<td><p>Either False or something False-y.</p></td>
+<td><p>Either <code>False</code> or something <code>False</code>-y.</p></td>
 </tr>
 </table>
 <p>Since 0.99</p>
diff --git a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.static_method.page b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.static_method.page
index 35c6c7b..2577eb8 100644
--- a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.static_method.page
+++ b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.static_method.page
@@ -32,11 +32,11 @@ and a return value.</p>
 <table>
 <tr>
 <td><p>out_arg :</p></td>
-<td><p>a pointer to int, or None to ignore</p></td>
+<td><p>a pointer to int, or <code>None</code> to ignore</p></td>
 </tr>
 <tr>
 <td><p>Returns :</p></td>
-<td><p>True if <code>out_arg</code> is valid, False otherwise</p></td>
+<td><p><code>True</code> if <code>out_arg</code> is valid, <code>False</code> otherwise</p></td>
 </tr>
 </table>
 </page>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]