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.
|
||||
|
||||
|
||||
Release 1.0.4 (Sep 17, 2010)
|
||||
============================
|
||||
|
||||
* #524: Open intersphinx inventories in binary mode on Windows,
|
||||
since version 2 contains zlib-compressed data.
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
\RequirePackage{amsmath} % for \text
|
||||
\RequirePackage{makeidx}
|
||||
\RequirePackage{framed}
|
||||
\RequirePackage{ifthen}
|
||||
\RequirePackage{color}
|
||||
% For highlighted code.
|
||||
\RequirePackage{fancyvrb}
|
||||
@ -462,3 +463,21 @@
|
||||
{#2}% node content
|
||||
}% 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
|
||||
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):
|
||||
self._line_start = len(self.body)
|
||||
self.body.append('\item[] ')
|
||||
def depart_line(self, node):
|
||||
if self._line_start == len(self.body):
|
||||
# no output in this line -- add a nonbreaking space, else the
|
||||
# \\ command will give an error
|
||||
self.body.append('~')
|
||||
if self.table is not None:
|
||||
self.body.append('\\newline\n')
|
||||
self.body.append('\n')
|
||||
|
||||
def visit_line_block(self, node):
|
||||
if isinstance(node.parent, nodes.line_block):
|
||||
self.body.append('\\item[]\n'
|
||||
'\\begin{DUlineblock}{\\DUlineblockindent}\n')
|
||||
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):
|
||||
# If the block quote contains a single object and that object
|
||||
|
@ -34,6 +34,16 @@ Option list:
|
||||
-h help
|
||||
--help also help
|
||||
|
||||
Line block:
|
||||
|
||||
| line1
|
||||
| line2
|
||||
| line3
|
||||
| line4
|
||||
| line5
|
||||
| line6
|
||||
| line7
|
||||
|
||||
|
||||
Body directives
|
||||
^^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user