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

This commit is contained in:
Georg Brandl 2007-08-04 23:07:57 +00:00
parent 5fa895a2c4
commit 3d44c1cb7f
3 changed files with 23 additions and 6 deletions

View File

@ -50,6 +50,9 @@ class compact_paragraph(nodes.paragraph): pass
# sets the highlighting language for literal blocks # sets the highlighting language for literal blocks
class highlightlang(nodes.Element): pass 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 # make them known to docutils. this is needed, because the HTMl writer
# will choke at some point if these are not added # will choke at some point if these are not added
nodes._add_node_class_names("""index desc desc_content desc_signature nodes._add_node_class_names("""index desc desc_content desc_signature

View File

@ -20,16 +20,16 @@ ws_re = re.compile(r'\s+')
generic_docroles = { generic_docroles = {
'command' : nodes.strong, 'command' : nodes.strong,
'dfn' : nodes.emphasis, 'dfn' : addnodes.literal_emphasis,
'guilabel' : nodes.strong, 'guilabel' : nodes.strong,
'kbd' : nodes.literal, 'kbd' : nodes.literal,
'keyword' : nodes.literal, 'keyword' : nodes.literal,
'mailheader' : nodes.emphasis, 'mailheader' : addnodes.literal_emphasis,
'makevar' : nodes.Text, 'makevar' : nodes.Text,
'manpage' : nodes.emphasis, 'manpage' : addnodes.literal_emphasis,
'mimetype' : nodes.emphasis, 'mimetype' : addnodes.literal_emphasis,
'newsgroup' : nodes.emphasis, 'newsgroup' : addnodes.literal_emphasis,
'option' : nodes.emphasis, 'option' : addnodes.literal_emphasis,
'program' : nodes.strong, 'program' : nodes.strong,
'regexp' : nodes.literal, 'regexp' : nodes.literal,
} }

View File

@ -196,6 +196,12 @@ class HTMLTranslator(BaseTranslator):
def visit_index(self, node): def visit_index(self, node):
raise nodes.SkipNode 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): class SmartyPantsHTMLTranslator(HTMLTranslator):
""" """
@ -215,6 +221,14 @@ class SmartyPantsHTMLTranslator(HTMLTranslator):
finally: finally:
self.no_smarty -= 1 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): def visit_productionlist(self, node):
self.no_smarty += 1 self.no_smarty += 1
try: try: