mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#535: Fix LaTeX output generated for line blocks by porting implementation from new docutils code.
This commit is contained in:
parent
5d2e8ac1c9
commit
644e157fa5
10
CHANGES
10
CHANGES
@ -1,8 +1,14 @@
|
|||||||
Release 1.0.4 (Sep 17, 2010)
|
Release 1.0.5 (in development)
|
||||||
============================
|
==============================
|
||||||
|
|
||||||
|
* #535: Fix LaTeX output generated for line blocks.
|
||||||
|
|
||||||
* #544: Allow ``.pyw`` as a source file extension.
|
* #544: Allow ``.pyw`` as a source file extension.
|
||||||
|
|
||||||
|
|
||||||
|
Release 1.0.4 (Sep 17, 2010)
|
||||||
|
============================
|
||||||
|
|
||||||
* #524: Open intersphinx inventories in binary mode on Windows,
|
* #524: Open intersphinx inventories in binary mode on Windows,
|
||||||
since version 2 contains zlib-compressed data.
|
since version 2 contains zlib-compressed data.
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
\RequirePackage{amsmath} % for \text
|
\RequirePackage{amsmath} % for \text
|
||||||
\RequirePackage{makeidx}
|
\RequirePackage{makeidx}
|
||||||
\RequirePackage{framed}
|
\RequirePackage{framed}
|
||||||
|
\RequirePackage{ifthen}
|
||||||
\RequirePackage{color}
|
\RequirePackage{color}
|
||||||
% For highlighted code.
|
% For highlighted code.
|
||||||
\RequirePackage{fancyvrb}
|
\RequirePackage{fancyvrb}
|
||||||
@ -462,3 +463,21 @@
|
|||||||
{#2}% node content
|
{#2}% node content
|
||||||
}% close "span"
|
}% close "span"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\providecommand*{\DUprovidelength}[2]{
|
||||||
|
\ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
\DUprovidelength{\DUlineblockindent}{2.5em}
|
||||||
|
\ifthenelse{\isundefined{\DUlineblock}}{
|
||||||
|
\newenvironment{DUlineblock}[1]{%
|
||||||
|
\list{}{\setlength{\partopsep}{\parskip}
|
||||||
|
\addtolength{\partopsep}{\baselineskip}
|
||||||
|
\setlength{\topsep}{0pt}
|
||||||
|
\setlength{\itemsep}{0.15\baselineskip}
|
||||||
|
\setlength{\parsep}{0pt}
|
||||||
|
\setlength{\leftmargin}{#1}}
|
||||||
|
\raggedright
|
||||||
|
}
|
||||||
|
{\endlist}
|
||||||
|
}{}
|
@ -1230,31 +1230,19 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
visit_doctest_block = visit_literal_block
|
visit_doctest_block = visit_literal_block
|
||||||
depart_doctest_block = depart_literal_block
|
depart_doctest_block = depart_literal_block
|
||||||
|
|
||||||
def visit_line_block(self, node):
|
|
||||||
"""line-block:
|
|
||||||
* whitespace (including linebreaks) is significant
|
|
||||||
* inline markup is supported.
|
|
||||||
* serif typeface
|
|
||||||
"""
|
|
||||||
self.body.append('\n{\\raggedright{}')
|
|
||||||
self.literal_whitespace += 1
|
|
||||||
def depart_line_block(self, node):
|
|
||||||
self.literal_whitespace -= 1
|
|
||||||
# remove the last \\
|
|
||||||
del self.body[-1]
|
|
||||||
self.body.append('}\n')
|
|
||||||
|
|
||||||
def visit_line(self, node):
|
def visit_line(self, node):
|
||||||
self._line_start = len(self.body)
|
self.body.append('\item[] ')
|
||||||
def depart_line(self, node):
|
def depart_line(self, node):
|
||||||
if self._line_start == len(self.body):
|
self.body.append('\n')
|
||||||
# no output in this line -- add a nonbreaking space, else the
|
|
||||||
# \\ command will give an error
|
def visit_line_block(self, node):
|
||||||
self.body.append('~')
|
if isinstance(node.parent, nodes.line_block):
|
||||||
if self.table is not None:
|
self.body.append('\\item[]\n'
|
||||||
self.body.append('\\newline\n')
|
'\\begin{DUlineblock}{\\DUlineblockindent}\n')
|
||||||
else:
|
else:
|
||||||
self.body.append('\\\\\n')
|
self.body.append('\n\\begin{DUlineblock}{0em}\n')
|
||||||
|
def depart_line_block(self, node):
|
||||||
|
self.body.append('\\end{DUlineblock}\n')
|
||||||
|
|
||||||
def visit_block_quote(self, node):
|
def visit_block_quote(self, node):
|
||||||
# If the block quote contains a single object and that object
|
# If the block quote contains a single object and that object
|
||||||
|
@ -34,6 +34,16 @@ Option list:
|
|||||||
-h help
|
-h help
|
||||||
--help also help
|
--help also help
|
||||||
|
|
||||||
|
Line block:
|
||||||
|
|
||||||
|
| line1
|
||||||
|
| line2
|
||||||
|
| line3
|
||||||
|
| line4
|
||||||
|
| line5
|
||||||
|
| line6
|
||||||
|
| line7
|
||||||
|
|
||||||
|
|
||||||
Body directives
|
Body directives
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
Loading…
Reference in New Issue
Block a user