git.iko.soy/typeable/pandoc
on master help sign in
Made spacing at end of output more consistent.

Previously some of the writers added spurious whitespace. This has been removed, resolving Issue #232. NOTE: If your application combines pandoc's output with other text, for example in a template, you may need to add spacing. For example, a pandoc-generated markdown file will not have a blank line after the final block element. If you are inserting it into another markdown file, you will need to make sure there is a blank line between it and the next block element.

commitfeb70b6e93151682d0560ea30318d5c23ecae8e9 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 20 Jul 2010, 12:42 (16 years ago) parent465a4a6
50 files changed+10−67
src/Text/Pandoc/Writers/ConTeXt.hs+1−1 src/Text/Pandoc/Writers/Man.hs+1−1 src/Text/Pandoc/Writers/Markdown.hs+1−1 src/Text/Pandoc/Writers/RST.hs+1−1 src/pandoc.hs+1−1 templates/docbook.template−1 tests/html-reader.native−1 tests/latex-reader.native−1 tests/lhs-test.fragment.html+lhs+1−1 tests/lhs-test.html−1 tests/lhs-test.html+lhs−1 tests/lhs-test.latex−1 tests/lhs-test.latex+lhs−1 tests/lhs-test.markdown−3 tests/lhs-test.markdown+lhs−3 tests/lhs-test.native−1 tests/lhs-test.rst−2 tests/lhs-test.rst+lhs−2 tests/markdown-reader-more.native−1 tests/rst-reader.native−1 tests/s5.basic.html−1 tests/s5.fancy.html−1 tests/s5.fragment.html+1−1 tests/s5.inserts.html−1 tests/tables-rstsubset.native−1 tests/tables.docbook+1−1 tests/tables.html+1−1 tests/tables.latex−1 tests/tables.markdown−3 tests/tables.mediawiki−1 tests/tables.native−1 tests/tables.opendocument+1−1 tests/tables.plain−3 tests/tables.rst−2 tests/tables.rtf−1 tests/tables.texinfo−1 tests/testsuite.native−1 tests/writer.context−1 tests/writer.docbook−2 tests/writer.html−1 tests/writer.latex−1 tests/writer.man−1 tests/writer.markdown−3 tests/writer.mediawiki−1 tests/writer.native−1 tests/writer.opendocument−1 tests/writer.plain−3 tests/writer.rst−2 tests/writer.rtf−1 tests/writer.texinfo−1
src/Text/Pandoc/Writers/ConTeXt.hs+1−1
@@ -64,7 +64,7 @@ pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
6464 then return ""
6565 else liftM render $ inlineListToConTeXt date
6666 body <- blockListToConTeXt blocks
67− let main = render body
67+ let main = render $ body $$ text ""
6868 let context = writerVariables options ++
6969 [ ("toc", if writerTableOfContents options then "yes" else "")
7070 , ("body", main)
src/Text/Pandoc/Writers/Man.hs+1−1
@@ -63,7 +63,7 @@ pandocToMan opts (Pandoc (Meta title authors date) blocks) = do
6363 body <- blockListToMan opts blocks
6464 notes <- liftM stNotes get
6565 notes' <- notesToMan opts (reverse notes)
66− let main = render $ body $$ notes'
66+ let main = render $ body $$ notes' $$ text ""
6767 hasTables <- liftM stHasTables get
6868 let context = writerVariables opts ++
6969 [ ("body", main)
src/Text/Pandoc/Writers/Markdown.hs+1−1
@@ -96,7 +96,7 @@ pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do
9696 notes' <- notesToMarkdown opts (reverse $ stNotes st)
9797 st' <- get -- note that the notes may contain refs
9898 refs' <- refsToMarkdown opts (reverse $ stRefs st')
99− let main = render $ body $+$ text "" $+$ notes' $+$ text "" $+$ refs'
99+ let main = render $ foldl ($+$) empty $ [body, notes', refs']
100100 let context = writerVariables opts ++
101101 [ ("toc", render toc)
102102 , ("body", main)
src/Text/Pandoc/Writers/RST.hs+1−1
@@ -70,7 +70,7 @@ pandocToRST (Pandoc (Meta tit auth dat) blocks) = do
7070 refs <- liftM (reverse . stLinks) get >>= refsToRST
7171 pics <- liftM (reverse . stImages) get >>= pictRefsToRST
7272 hasMath <- liftM stHasMath get
73− let main = render $ body $+$ notes $+$ text "" $+$ refs $+$ pics
73+ let main = render $ foldl ($+$) empty $ [body, notes, refs, pics]
7474 let context = writerVariables opts ++
7575 [ ("body", main)
7676 , ("title", render title)
src/pandoc.hs+1−1
@@ -833,5 +833,5 @@ main = do
833833 writerOutput <- writer writerOptions doc''
834834
835835 if outputFile == "-"
836− then B.putStrLn writerOutput
836+ then B.putStr writerOutput
837837 else B.writeFile outputFile writerOutput
templates/docbook.template−1
@@ -25,4 +25,3 @@ $for(include-after)$
2525$include-after$
2626$endfor$
2727</article>
28−
tests/html-reader.native−1
@@ -344,4 +344,3 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
344344, Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
345345, CodeBlock ("",[],[]) " { <code> }"
346346, Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."] ]
347−
tests/latex-reader.native−1
@@ -375,4 +375,3 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
375375 [ [ Para [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]] ]
376376 ]
377377, Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."] ]
378−
tests/lhs-test.fragment.html+lhs+1−1
@@ -36,4 +36,4 @@
3636><p
3737 >foo bar</p
3838 ></blockquote
39−>
39+>
tests/lhs-test.html−1
@@ -66,4 +66,3 @@ pre.sourceCode span.er { color: red; font-weight: bold; }
6666>
6767</body>
6868</html>
69−
tests/lhs-test.html+lhs−1
@@ -66,4 +66,3 @@ pre.sourceCode span.er { color: red; font-weight: bold; }
6666>
6767</body>
6868</html>
69−
tests/lhs-test.latex−1
@@ -35,4 +35,3 @@ foo bar
3535\end{quote}
3636
3737\end{document}
38−
tests/lhs-test.latex+lhs−1
@@ -37,4 +37,3 @@ foo bar
3737\end{quote}
3838
3939\end{document}
40−
tests/lhs-test.markdown−3
@@ -16,6 +16,3 @@ and one arrow on the second item of the pair).
1616Block quote:
1717
1818> foo bar
19−
20−
21−
tests/lhs-test.markdown+lhs−3
@@ -17,6 +17,3 @@ and one arrow on the second item of the pair).
1717Block quote:
1818
1919 > foo bar
20−
21−
22−
tests/lhs-test.native−1
@@ -8,4 +8,3 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
88, BlockQuote
99 [ Para [Str "foo",Space,Str "bar"] ]
1010 ]
11−
tests/lhs-test.rst−2
@@ -22,5 +22,3 @@ Block quote:
2222
2323 foo bar
2424
25−
26−
tests/lhs-test.rst+lhs−2
@@ -20,5 +20,3 @@ Block quote:
2020
2121 foo bar
2222
23−
24−
tests/markdown-reader-more.native−1
@@ -40,4 +40,3 @@ Pandoc (Meta {docTitle = [Str "Title",Space,Str "spanning",Space,Str "multiple",
4040, OrderedList (3,Example,TwoParens)
4141 [ [ Plain [Str "Third",Space,Str "example",Str "."] ]
4242 ] ]
43−
tests/rst-reader.native−1
@@ -309,4 +309,3 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":
309309 [ [ Plain [Str "b"] ]
310310 , [ Plain [Str "b",Space,Str "2"] ]
311311 , [ Plain [Str "b",Space,Str "2"] ] ] ], [ Plain [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"] ] ] ] ]
312−
tests/s5.basic.html−1
@@ -316,4 +316,3 @@
316316</div>
317317</body>
318318</html>
319−
tests/s5.fancy.html−1
@@ -517,4 +517,3 @@
517517</div>
518518</body>
519519</html>
520−
tests/s5.fragment.html+1−1
@@ -14,4 +14,4 @@
1414 >$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span
1515 ></li
1616 ></ul
17−>
17+>
tests/s5.inserts.html−1
@@ -33,4 +33,3 @@ STUFF INSERTED
3333STUFF INSERTED
3434</body>
3535</html>
36−
tests/tables-rstsubset.native−1
@@ -116,4 +116,3 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
116116 , [ Plain [Str "row"] ]
117117 , [ Plain [Str "5.0"] ]
118118 , [ Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."] ] ] ] ]
119−
tests/tables.docbook+1−1
@@ -399,4 +399,4 @@
399399 </td>
400400 </tr>
401401 </tbody>
402−</informaltable>
402+</informaltable>
tests/tables.html+1−1
@@ -298,4 +298,4 @@
298298 ></tr
299299 ></tbody
300300 ></table
301−>
301+>
tests/tables.latex−1
@@ -175,4 +175,3 @@ Second
175175\\
176176\end{tabular}
177177\end{center}
178−
tests/tables.markdown−3
@@ -74,6 +74,3 @@ Multiline table without column headers:
7474 the blank line between
7575 rows.
7676 ----------- ---------- ------------ --------------------------
77−
78−
79−
tests/tables.mediawiki−1
@@ -209,4 +209,3 @@ Multiline table without column headers:
209209</tr>
210210</tbody>
211211</table>
212−
tests/tables.native−1
@@ -113,4 +113,3 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
113113 , [ Plain [Str "row"] ]
114114 , [ Plain [Str "5",Str ".",Str "0"] ]
115115 , [ Plain [Str "Here",Str "'",Str "s",Space,Str "another",Space,Str "one",Str ".",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows",Str "."] ] ] ] ]
116−
tests/tables.opendocument+1−1
@@ -381,4 +381,4 @@
381381 <text:p text:style-name="Table_20_Contents">Here's another one. Note the blank line between rows.</text:p>
382382 </table:table-cell>
383383 </table:table-row>
384−</table:table>
384+</table:table>
tests/tables.plain−3
@@ -74,6 +74,3 @@ Multiline table without column headers:
7474 the blank line between
7575 rows.
7676 ----------- ---------- ------------ --------------------------
77−
78−
79−
tests/tables.rst−2
@@ -88,5 +88,3 @@ Multiline table without column headers:
8888| | | | the blank line between |
8989| | | | rows. |
9090+-------------+------------+--------------+----------------------------+
91−
92−
tests/tables.rtf−1
@@ -357,4 +357,3 @@
357357}
358358\intbl\row}
359359{\pard \ql \f0 \sa180 \li0 \fi0 \par}
360−
tests/tables.texinfo−1
@@ -156,4 +156,3 @@ Second
156156 @tab 5.0
157157 @tab Here's another one. Note the blank line between rows.
158158@end multitable
159−
tests/testsuite.native−1
@@ -415,4 +415,3 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
415415 [ [ Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items",Str ".",Note [Para [Str "In",Space,Str "list",Str "."]]] ]
416416 ]
417417, Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented",Str "."] ]
418−
tests/writer.context−1
@@ -906,4 +906,3 @@ This paragraph should not be part of the note, as it is not
906906indented.
907907
908908\stoptext
909−
tests/writer.docbook−2
@@ -1462,5 +1462,3 @@ or here: &lt;http://example.com/&gt;
14621462 </para>
14631463</section>
14641464</article>
1465−
1466−
tests/writer.html−1
@@ -1163,4 +1163,3 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+
11631163>
11641164</body>
11651165</html>
1166−
tests/writer.latex−1
@@ -864,4 +864,3 @@ This paragraph should not be part of the note, as it is not
864864indented.
865865
866866\end{document}
867−
tests/writer.man−1
@@ -798,4 +798,3 @@ In quote.
798798In list.
799799.SH AUTHORS
800800John MacFarlane; Anonymous.
801−
tests/writer.markdown−3
@@ -715,7 +715,6 @@ note] Here is an inline note.[^3]
715715This paragraph should not be part of the note, as it is not
716716indented.
717717
718−
719718[^1]:
720719 Here is the footnote. It can go anywhere after the footnote
721720 reference. It need not be placed at the end of the document.
@@ -741,5 +740,3 @@ indented.
741740
742741[^5]:
743742 In list.
744−
745−
tests/writer.mediawiki−1
@@ -660,4 +660,3 @@ If you want, you can indent every line, but you can also be lazy and just indent
660660This paragraph should not be part of the note, as it is not indented.
661661
662662<references />
663−
tests/writer.native−1
@@ -415,4 +415,3 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
415415 [ [ Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items",Str ".",Note [Para [Str "In",Space,Str "list",Str "."]]] ]
416416 ]
417417, Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented",Str "."] ]
418−
tests/writer.opendocument−1
@@ -1452,4 +1452,3 @@ Cat <text:s text:c="3" />&amp; 1 <text:s text:c="5" />\\ \hline
14521452</office:text>
14531453</office:body>
14541454</office:document-content>
1455−
tests/writer.plain−3
@@ -669,7 +669,6 @@ Here is an inline note.[^3]
669669This paragraph should not be part of the note, as it is not
670670indented.
671671
672−
673672[^1]:
674673 Here is the footnote. It can go anywhere after the footnote
675674 reference. It need not be placed at the end of the document.
@@ -694,5 +693,3 @@ indented.
694693
695694[^5]:
696695 In list.
697−
698−
tests/writer.rst−2
@@ -888,6 +888,4 @@ indented.
888888.. [5]
889889 In list.
890890
891−
892891.. |movie| image:: movie.jpg
893−
tests/writer.rtf−1
@@ -450,4 +450,3 @@ links
450450}\sa180\par}
451451{\pard \ql \f0 \sa180 \li0 \fi0 This paragraph should not be part of the note, as it is not indented.\par}
452452}
453−
tests/writer.texinfo−1
@@ -1014,4 +1014,3 @@ And in list items.@footnote{In list.}
10141014This paragraph should not be part of the note@comma{} as it is not indented.
10151015
10161016@bye
1017−