diff options
| author | georg.brandl <devnull@localhost> | 2008-03-19 08:00:25 +0000 |
|---|---|---|
| committer | georg.brandl <devnull@localhost> | 2008-03-19 08:00:25 +0000 |
| commit | fe01c3b72637b72d4f1547fa3ac32e5507bda985 (patch) | |
| tree | cbacb0e2d53a237d9b54c796161f9920f13f89de | |
| parent | 1431c723416065a211665c4fe669f1a72683a45c (diff) | |
| download | sphinx-fe01c3b72637b72d4f1547fa3ac32e5507bda985.tar.gz | |
* Support \classdescni.
* Generate valid highlighting code even if code doesn't end in \n.
| -rw-r--r-- | sphinx/latexwriter.py | 7 | ||||
| -rw-r--r-- | sphinx/texinputs/sphinx.sty | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sphinx/latexwriter.py b/sphinx/latexwriter.py index cc0d8bc9..8e27bd19 100644 --- a/sphinx/latexwriter.py +++ b/sphinx/latexwriter.py @@ -656,9 +656,10 @@ class LaTeXTranslator(nodes.NodeVisitor): hlcode = self.highlighter.highlight_block(code, lang, linenos) # workaround for Unicode issue hlcode = hlcode.replace(u'€', u'@texteuro[]') - # workaround for Pygments bug - hlcode = hlcode.replace('\n\\end{Verbatim}', '\\end{Verbatim}') - self.body.append('\n' + hlcode) + # get consistent trailer + hlcode = hlcode.rstrip()[:-14] # strip \end{Verbatim} + hlcode = hlcode.rstrip() + '\n' + self.body.append('\n' + hlcode + '\\end{Verbatim}\n') self.verbatim = None visit_doctest_block = visit_literal_block depart_doctest_block = depart_literal_block diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 2dbd2b09..f3db4664 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -685,6 +685,15 @@ \classline{#1}{#2} }{\end{fulllineitems}} +\newcommand{\classlineni}[2]{ + \py@sigline{\strong{class }\bfcode{#1}}{#2}} +\newenvironment{classdescni}[2]{ + % Using \renewcommand doesn't work for this, for unknown reasons: + \global\def\py@thisclass{#1} + \begin{fulllineitems} + \classlineni{#1}{#2} +}{\end{fulllineitems}} + % \begin{classdesc*}{name} \newenvironment{classdesc*}[1]{ % Using \renewcommand doesn't work for this, for unknown reasons: |
