Fix #722: remove special styling of :samp: role, and enable placeholder formatting in literal nodes.

This commit is contained in:
Georg Brandl 2011-09-21 09:47:18 +02:00
parent 1e05041ea5
commit 6d6e6abfdb
2 changed files with 5 additions and 8 deletions

View File

@ -128,7 +128,6 @@
\newcommand{\strong}[1]{{\bf #1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\bfcode}[1]{\code{\bfseries#1}}
\newcommand{\samp}[1]{`\code{#1}'}
\newcommand{\email}[1]{\textsf{#1}}
% Redefine the Verbatim environment to allow border and background colors.

View File

@ -1246,15 +1246,13 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_literal(self, node):
self.no_contractions += 1
content = self.encode(node.astext().strip())
self.no_contractions -= 1
if self.in_title:
self.body.append(r'\texttt{%s}' % content)
elif node.get('role') == 'samp':
self.body.append(r'\samp{%s}' % content)
self.body.append(r'\texttt{')
else:
self.body.append(r'\code{%s}' % content)
raise nodes.SkipNode
self.body.append(r'\code{')
def depart_literal(self, node):
self.no_contractions -= 1
self.body.append('}')
def visit_footnote_reference(self, node):
num = node.astext().strip()