From 6d6e6abfdb2b01bfa9ff8952ab11b87c7a756a6a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 21 Sep 2011 09:47:18 +0200 Subject: [PATCH] Fix #722: remove special styling of :samp: role, and enable placeholder formatting in literal nodes. --- sphinx/texinputs/sphinx.sty | 1 - sphinx/writers/latex.py | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 21a3d8941..ef7b891bc 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -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. diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index d9f1fad92..d4b2695a9 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -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()