mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* Support \classdescni.
* Generate valid highlighting code even if code doesn't end in \n.
This commit is contained in:
parent
7b298368d3
commit
c0a44f7996
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user