mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix display of "--" in long option strings.
This commit is contained in:
parent
df7e93dcf1
commit
50d15d947d
@ -221,6 +221,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.first_document = 1
|
self.first_document = 1
|
||||||
self.this_is_the_title = 1
|
self.this_is_the_title = 1
|
||||||
self.literal_whitespace = 0
|
self.literal_whitespace = 0
|
||||||
|
self.no_contractions = 0
|
||||||
|
|
||||||
def astext(self):
|
def astext(self):
|
||||||
return (HEADER % self.elements + self.highlighter.get_stylesheet() +
|
return (HEADER % self.elements + self.highlighter.get_stylesheet() +
|
||||||
@ -939,8 +940,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
def visit_literal_emphasis(self, node):
|
def visit_literal_emphasis(self, node):
|
||||||
self.body.append(r'\emph{\texttt{')
|
self.body.append(r'\emph{\texttt{')
|
||||||
|
self.no_contractions += 1
|
||||||
def depart_literal_emphasis(self, node):
|
def depart_literal_emphasis(self, node):
|
||||||
self.body.append('}}')
|
self.body.append('}}')
|
||||||
|
self.no_contractions -= 1
|
||||||
|
|
||||||
def visit_strong(self, node):
|
def visit_strong(self, node):
|
||||||
self.body.append(r'\textbf{')
|
self.body.append(r'\textbf{')
|
||||||
@ -1101,7 +1104,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
def visit_option_string(self, node):
|
def visit_option_string(self, node):
|
||||||
ostring = node.astext()
|
ostring = node.astext()
|
||||||
self.body.append(self.encode(ostring.replace('--', u'--')))
|
self.body.append(self.encode(ostring.replace('--', u'-{-}')))
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
def visit_description(self, node):
|
def visit_description(self, node):
|
||||||
@ -1153,6 +1156,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
# Insert a blank before the newline, to avoid
|
# Insert a blank before the newline, to avoid
|
||||||
# ! LaTeX Error: There's no line here to end.
|
# ! LaTeX Error: There's no line here to end.
|
||||||
text = text.replace(u'\n', u'~\\\\\n').replace(u' ', u'~')
|
text = text.replace(u'\n', u'~\\\\\n').replace(u' ', u'~')
|
||||||
|
if self.no_contractions:
|
||||||
|
text = text.replace('--', u'-{-}')
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def visit_Text(self, node):
|
def visit_Text(self, node):
|
||||||
|
Loading…
Reference in New Issue
Block a user