diff options
-rw-r--r-- | changelog | 85 | ||||
-rw-r--r-- | pandoc.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 20 | ||||
-rw-r--r-- | tests/tables.latex | 188 | ||||
-rw-r--r-- | tests/writer.latex | 26 |
5 files changed, 208 insertions, 113 deletions
@@ -1,3 +1,88 @@ +pandoc (XXX) + + * Fixed `--self-contained` with Windows paths (#1558). + Previously `C:\foo.js` was being wrongly interpreted as a URI. + + * HTML reader: improved handling of tags that can be block or inline. + Previously a section like this would be enclosed in a paragraph, + with RawInline for the video tags (since video is a tag that can + be either block or inline): + + <video controls="controls"> + <source src="../videos/test.mp4" type="video/mp4" /> + <source src="../videos/test.webm" type="video/webm" /> + <p> + The videos can not be played back on your system.<br/> + Try viewing on Youtube (requires Internet connection): + <a href="http://youtu.be/etE5urBps_w">Relative Velocity on + Youtube</a>. + </p> + </video> + + This change will cause the video and source tags to be parsed + as RawBlock instead, giving better output. + The general change is this: when we're parsing a "plain" sequence + of inlines, we don't parse anything that COULD be a block-level tag. + + * Docx reader: + + + Be sensitive to user styles. Note that "Hyperlink" is + "blacklisted," as we don't want the default underline styling to be + inherited by all links by default (Jesse Rosenthal). + + Read single paragraph in table cell as `Plain` (Jesse Rosenthal). + This makes to docx reader's native output fit with the way the markdown + reader understands its markdown output. + + * Txt2Tags reader: + + + Header is now parsed only if standalone flag is set (Matthew Pickering). + + The header is now parsed as meta information. The first line is the + `title`, the second is the `author` and third line is the `date` + (Matthew Pickering). + + Corrected formatting of `%%mtime` macro (Matthew Pickering). + + Fixed crash when reading from stdin. + + * EPUB writer: Don't use page-progression-direction in EPUB2, which + doesn't support it. Also, if page-progression-direction not specified + in metadata, don't include the attribute even in EPUB3; not including it + is the same as including it with the value "default", as we did before. + (#1550) + + * Org writer: Accept example lines with indentation at the beginning + (Calvin Beck). + + * DokuWiki writer: Refactor to use Reader monad (Matthew Pickering). + + * Docx writer: + + + Bibliography entries get `Bibliography` style (#1559). + + Implement change tracking (Jesse Rosenthal). + + * LaTeX writer: + + + Fixed a bug that caused a table caption to repeat across all pages + (Jose Luis Duran). + + Improved vertical spacing in tables and made it customizable using + standard lengths set by booktab. See + <https://groups.google.com/forum/#!msg/pandoc-discuss/qMu6_5lYy0o/ZAU7lzAIKw0J> + (Jose Luis Duran). + + Added `\strut` to fix spacing in multiline tables (Jose Luis Duran). + + Use `\tabularnewline` instead of `\\` in table cells (Jose Luis Duran). + + Made horizontal rules more flexible (Jose Luis Duran). + + * Templates: + + + LaTeX template: disable microtype protrusion for typewriter font (#1549, + thanks lemzwerg). + + * Improved OSX build procedure. + + * Added `network-uri` flag, to deal with split of `network-uri` from + `network`. + + * Fix build dependencies for the `trypandoc` flag, so that they are + ignored if `trypandoc` flag is set to False (Gabor Pali). + pandoc (1.13.0.1) * Docx writer: @@ -75,7 +75,7 @@ import Data.Monoid type Transform = Pandoc -> Pandoc copyrightMessage :: String -copyrightMessage = unlines [ +copyrightMessage = intercalate "\n" [ "", "Copyright (C) 2006-2014 John MacFarlane", "Web: http://johnmacfarlane.net/pandoc", diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index d200ecee1..acbe8a48d 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -465,18 +465,24 @@ blockToLaTeX (DefinitionList lst) = do return $ text ("\\begin{description}" ++ inc) $$ spacing $$ vcat items $$ "\\end{description}" blockToLaTeX HorizontalRule = return $ - "\\begin{center}\\rule{3in}{0.4pt}\\end{center}" + "\\begin{center}\\rule{0.5\\linewidth}{\\linethickness}\\end{center}" blockToLaTeX (Header level (id',classes,_) lst) = sectionHeader ("unnumbered" `elem` classes) id' level lst blockToLaTeX (Table caption aligns widths heads rows) = do headers <- if all null heads then return empty - else ($$ "\\midrule\\endhead") `fmap` + else ($$ "\\midrule\n") `fmap` (tableRowToLaTeX True aligns widths) heads + let endhead = if all null heads + then empty + else text "\\endhead" captionText <- inlineListToLaTeX caption let capt = if isEmpty captionText then empty - else text "\\caption" <> braces captionText <> "\\\\" + else text "\\caption" <> braces captionText + <> "\\tabularnewline\n\\toprule\n" + <> headers + <> "\\endfirsthead" rows' <- mapM (tableRowToLaTeX False aligns widths) rows let colDescriptors = text $ concat $ map toColDescriptor aligns modify $ \s -> s{ stTable = True } @@ -484,8 +490,9 @@ blockToLaTeX (Table caption aligns widths heads rows) = do braces ("@{}" <> colDescriptors <> "@{}") -- the @{} removes extra space at beginning and end $$ capt - $$ "\\toprule\\addlinespace" + $$ "\\toprule" $$ headers + $$ endhead $$ vcat rows' $$ "\\bottomrule" $$ "\\end{longtable}" @@ -512,7 +519,7 @@ tableRowToLaTeX header aligns widths cols = do let scaleFactor = 0.97 ** fromIntegral (length aligns) let widths' = map (scaleFactor *) widths cells <- mapM (tableCellToLaTeX header) $ zip3 widths' aligns cols - return $ hsep (intersperse "&" cells) $$ "\\\\\\addlinespace" + return $ hsep (intersperse "&" cells) <> "\\tabularnewline" -- For simple latex tables (without minipages or parboxes), -- we need to go to some lengths to get line breaks working: @@ -549,7 +556,8 @@ tableCellToLaTeX header (width, align, blocks) = do AlignDefault -> "\\raggedright" return $ ("\\begin{minipage}" <> valign <> braces (text (printf "%.2f\\columnwidth" width)) <> - (halign <> cr <> cellContents <> cr) <> "\\end{minipage}") + (halign <> "\\strut" <> cr <> cellContents <> cr) <> + "\\strut\\end{minipage}") $$ case notes of [] -> empty ns -> (case length ns of diff --git a/tests/tables.latex b/tests/tables.latex index eb665204d..850629499 100644 --- a/tests/tables.latex +++ b/tests/tables.latex @@ -1,166 +1,168 @@ Simple table with caption: \begin{longtable}[c]{@{}rlcl@{}} -\caption{Demonstration of simple table syntax.}\\ -\toprule\addlinespace -Right & Left & Center & Default -\\\addlinespace -\midrule\endhead -12 & 12 & 12 & 12 -\\\addlinespace -123 & 123 & 123 & 123 -\\\addlinespace -1 & 1 & 1 & 1 -\\\addlinespace +\caption{Demonstration of simple table syntax.}\tabularnewline +\toprule +Right & Left & Center & Default\tabularnewline +\midrule +\endfirsthead +\toprule +Right & Left & Center & Default\tabularnewline +\midrule +\endhead +12 & 12 & 12 & 12\tabularnewline +123 & 123 & 123 & 123\tabularnewline +1 & 1 & 1 & 1\tabularnewline \bottomrule \end{longtable} Simple table without caption: \begin{longtable}[c]{@{}rlcl@{}} -\toprule\addlinespace -Right & Left & Center & Default -\\\addlinespace -\midrule\endhead -12 & 12 & 12 & 12 -\\\addlinespace -123 & 123 & 123 & 123 -\\\addlinespace -1 & 1 & 1 & 1 -\\\addlinespace +\toprule +Right & Left & Center & Default\tabularnewline +\midrule +\endhead +12 & 12 & 12 & 12\tabularnewline +123 & 123 & 123 & 123\tabularnewline +1 & 1 & 1 & 1\tabularnewline \bottomrule \end{longtable} Simple table indented two spaces: \begin{longtable}[c]{@{}rlcl@{}} -\caption{Demonstration of simple table syntax.}\\ -\toprule\addlinespace -Right & Left & Center & Default -\\\addlinespace -\midrule\endhead -12 & 12 & 12 & 12 -\\\addlinespace -123 & 123 & 123 & 123 -\\\addlinespace -1 & 1 & 1 & 1 -\\\addlinespace +\caption{Demonstration of simple table syntax.}\tabularnewline +\toprule +Right & Left & Center & Default\tabularnewline +\midrule +\endfirsthead +\toprule +Right & Left & Center & Default\tabularnewline +\midrule +\endhead +12 & 12 & 12 & 12\tabularnewline +123 & 123 & 123 & 123\tabularnewline +1 & 1 & 1 & 1\tabularnewline \bottomrule \end{longtable} Multiline table with caption: \begin{longtable}[c]{@{}clrl@{}} -\caption{Here's the caption. It may span multiple lines.}\\ -\toprule\addlinespace -\begin{minipage}[b]{0.13\columnwidth}\centering +\caption{Here's the caption. It may span multiple lines.}\tabularnewline +\toprule +\begin{minipage}[b]{0.13\columnwidth}\centering\strut Centered Header -\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut Left Aligned -\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut Right Aligned -\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut Default aligned -\end{minipage} -\\\addlinespace -\midrule\endhead -\begin{minipage}[t]{0.13\columnwidth}\centering +\strut\end{minipage}\tabularnewline +\midrule +\endfirsthead +\toprule +\begin{minipage}[b]{0.13\columnwidth}\centering\strut +Centered Header +\strut\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut +Left Aligned +\strut\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut +Right Aligned +\strut\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut +Default aligned +\strut\end{minipage}\tabularnewline +\midrule +\endhead +\begin{minipage}[t]{0.13\columnwidth}\centering\strut First -\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut row -\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut 12.0 -\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut Example of a row that spans multiple lines. -\end{minipage} -\\\addlinespace -\begin{minipage}[t]{0.13\columnwidth}\centering +\strut\end{minipage}\tabularnewline +\begin{minipage}[t]{0.13\columnwidth}\centering\strut Second -\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut row -\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut 5.0 -\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut Here's another one. Note the blank line between rows. -\end{minipage} -\\\addlinespace +\strut\end{minipage}\tabularnewline \bottomrule \end{longtable} Multiline table without caption: \begin{longtable}[c]{@{}clrl@{}} -\toprule\addlinespace -\begin{minipage}[b]{0.13\columnwidth}\centering +\toprule +\begin{minipage}[b]{0.13\columnwidth}\centering\strut Centered Header -\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut Left Aligned -\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut Right Aligned -\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut Default aligned -\end{minipage} -\\\addlinespace -\midrule\endhead -\begin{minipage}[t]{0.13\columnwidth}\centering +\strut\end{minipage}\tabularnewline +\midrule +\endhead +\begin{minipage}[t]{0.13\columnwidth}\centering\strut First -\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut row -\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut 12.0 -\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut Example of a row that spans multiple lines. -\end{minipage} -\\\addlinespace -\begin{minipage}[t]{0.13\columnwidth}\centering +\strut\end{minipage}\tabularnewline +\begin{minipage}[t]{0.13\columnwidth}\centering\strut Second -\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut row -\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut 5.0 -\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut Here's another one. Note the blank line between rows. -\end{minipage} -\\\addlinespace +\strut\end{minipage}\tabularnewline \bottomrule \end{longtable} Table without column headers: \begin{longtable}[c]{@{}rlcr@{}} -\toprule\addlinespace -12 & 12 & 12 & 12 -\\\addlinespace -123 & 123 & 123 & 123 -\\\addlinespace -1 & 1 & 1 & 1 -\\\addlinespace +\toprule +12 & 12 & 12 & 12\tabularnewline +123 & 123 & 123 & 123\tabularnewline +1 & 1 & 1 & 1\tabularnewline \bottomrule \end{longtable} Multiline table without column headers: \begin{longtable}[c]{@{}clrl@{}} -\toprule\addlinespace -\begin{minipage}[t]{0.13\columnwidth}\centering +\toprule +\begin{minipage}[t]{0.13\columnwidth}\centering\strut First -\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut row -\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut 12.0 -\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut Example of a row that spans multiple lines. -\end{minipage} -\\\addlinespace -\begin{minipage}[t]{0.13\columnwidth}\centering +\strut\end{minipage}\tabularnewline +\begin{minipage}[t]{0.13\columnwidth}\centering\strut Second -\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut row -\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft +\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut 5.0 -\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright +\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut Here's another one. Note the blank line between rows. -\end{minipage} -\\\addlinespace +\strut\end{minipage}\tabularnewline \bottomrule \end{longtable} diff --git a/tests/writer.latex b/tests/writer.latex index b1b4bbffb..8b3ca3192 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -69,7 +69,7 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite. -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Headers}\label{headers} @@ -94,7 +94,7 @@ with no blank line with no blank line -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Paragraphs}\label{paragraphs} @@ -108,7 +108,7 @@ Here's one with a bullet. * criminey. There should be a hard line break\\here. -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Block Quotes}\label{block-quotes} @@ -153,7 +153,7 @@ This should not be a block quote: 2 \textgreater{} 1. And a following paragraph. -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Code Blocks}\label{code-blocks} @@ -177,7 +177,7 @@ And: These should not be escaped: \$ \\ \> \[ \{ \end{verbatim} -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Lists}\label{lists} @@ -485,7 +485,7 @@ M.A.~2007 B. Williams -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Definition Lists}\label{definition-lists} @@ -650,7 +650,7 @@ Code: Hr's: -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Inline Markup}\label{inline-markup} @@ -682,7 +682,7 @@ H\textsubscript{many~of~them}O. These should not be superscripts or subscripts, because of the unescaped spaces: a\^{}b c\^{}d, a\textasciitilde{}b c\textasciitilde{}d. -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Smart quotes, ellipses, dashes}\label{smart-quotes-ellipses-dashes} @@ -703,7 +703,7 @@ Dashes between numbers: 5--7, 255--66, 1987--1999. Ellipses\ldots{}and\ldots{}and\ldots{}. -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{LaTeX}\label{latex} @@ -751,7 +751,7 @@ Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Special Characters}\label{special-characters} @@ -813,7 +813,7 @@ Plus: + Minus: - -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Links}\label{links} @@ -905,7 +905,7 @@ Auto-links should not occur here: or here: <http://example.com/> \end{verbatim} -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Images}\label{images} @@ -919,7 +919,7 @@ From ``Voyage dans la Lune'' by Georges Melies (1902): Here is a movie \includegraphics{movie.jpg} icon. -\begin{center}\rule{3in}{0.4pt}\end{center} +\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} \section{Footnotes}\label{footnotes} |