Anonymous avatar Anonymous committed b88cd9c

Don't mangle "--" in option names.

Comments (0)

Files changed (3)

sphinx/addnodes.py

 # 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
 
 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,
 }
     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):
     """
         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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.