[Python-checkins] r56746 - doctools/trunk/sphinx/addnodes.py doctools/trunk/sphinx/roles.py doctools/trunk/sphinx/writer.py

georg.brandl python-checkins at python.org
Sun Aug 5 01:07:58 CEST 2007


Author: georg.brandl
Date: Sun Aug  5 01:07:57 2007
New Revision: 56746

Modified:
   doctools/trunk/sphinx/addnodes.py
   doctools/trunk/sphinx/roles.py
   doctools/trunk/sphinx/writer.py
Log:
Don't mangle "--" in option names.


Modified: doctools/trunk/sphinx/addnodes.py
==============================================================================
--- doctools/trunk/sphinx/addnodes.py	(original)
+++ doctools/trunk/sphinx/addnodes.py	Sun Aug  5 01:07:57 2007
@@ -50,6 +50,9 @@
 # sets the highlighting language for literal blocks
 class highlightlang(nodes.Element): pass
 
+# doesn't apply further text processors, e.g. smartypants
+class literal_emphasis(nodes.emphasis): pass
+
 # make them known to docutils. this is needed, because the HTMl writer
 # will choke at some point if these are not added
 nodes._add_node_class_names("""index desc desc_content desc_signature

Modified: doctools/trunk/sphinx/roles.py
==============================================================================
--- doctools/trunk/sphinx/roles.py	(original)
+++ doctools/trunk/sphinx/roles.py	Sun Aug  5 01:07:57 2007
@@ -20,16 +20,16 @@
 
 generic_docroles = {
     'command' : nodes.strong,
-    'dfn' : nodes.emphasis,
+    'dfn' : addnodes.literal_emphasis,
     'guilabel' : nodes.strong,
     'kbd' : nodes.literal,
     'keyword' : nodes.literal,
-    'mailheader' : nodes.emphasis,
+    'mailheader' : addnodes.literal_emphasis,
     'makevar' : nodes.Text,
-    'manpage' : nodes.emphasis,
-    'mimetype' : nodes.emphasis,
-    'newsgroup' : nodes.emphasis,
-    'option' : nodes.emphasis,
+    'manpage' : addnodes.literal_emphasis,
+    'mimetype' : addnodes.literal_emphasis,
+    'newsgroup' : addnodes.literal_emphasis,
+    'option' : addnodes.literal_emphasis,
     'program' : nodes.strong,
     'regexp' : nodes.literal,
 }

Modified: doctools/trunk/sphinx/writer.py
==============================================================================
--- doctools/trunk/sphinx/writer.py	(original)
+++ doctools/trunk/sphinx/writer.py	Sun Aug  5 01:07:57 2007
@@ -196,6 +196,12 @@
     def visit_index(self, node):
         raise nodes.SkipNode
 
+    # these are only handled specially in the SmartyPantsHTMLTranslator
+    def visit_literal_emphasis(self, node):
+        return self.visit_emphasis(node)
+    def depart_literal_emphasis(self, node):
+        return self.depart_emphasis(node)
+
 
 class SmartyPantsHTMLTranslator(HTMLTranslator):
     """
@@ -215,6 +221,14 @@
         finally:
             self.no_smarty -= 1
 
+    def visit_literal_emphasis(self, node):
+        self.no_smarty += 1
+        self.visit_emphasis(node)
+
+    def depart_literal_emphasis(self, node):
+        self.depart_emphasis(node)
+        self.no_smarty -= 1
+
     def visit_productionlist(self, node):
         self.no_smarty += 1
         try:


More information about the Python-checkins mailing list