Merge pull request #1925 from timtylin/patch/prettyLineBreaks
Append newline to the LineBreak of various writers
commit0a1cd2531243d2fd82e442448602705ac9174873
authorJohn MacFarlane <jgm@berkeley.edu>
dateSat 7 Feb 2015, 20:21 (12 years ago)
parentfb7a03d0c18f3a
src/Text/Pandoc/Writers/DokuWiki.hs+1−1
@@ -459,7 +459,7 @@ inlineToDokuWiki _ (RawInline f str)
459459 | f == Format "html" = return $ "<html>" ++ str ++ "</html>"
460460 | otherwise = return ""
461461
462−inlineToDokuWiki _ (LineBreak) = return "\\\\ "
462+inlineToDokuWiki _ (LineBreak) = return "\\\\\n"
463463
464464inlineToDokuWiki _ Space = return " "
465465
src/Text/Pandoc/Writers/HTML.hs+2−1
@@ -656,7 +656,8 @@ inlineToHtml opts inline =
656656 case inline of
657657 (Str str) -> return $ strToHtml str
658658 (Space) -> return $ strToHtml " "
659− (LineBreak) -> return $ if writerHtml5 opts then H5.br else H.br
659+ (LineBreak) -> return $ (if writerHtml5 opts then H5.br else H.br)
660+ <> strToHtml "\n"
660661 (Span (id',classes,kvs) ils)
661662 -> inlineListToHtml opts ils >>=
662663 return . addAttrs opts attr' . H.span
src/Text/Pandoc/Writers/LaTeX.hs+1−1
@@ -802,7 +802,7 @@ inlineToLaTeX (RawInline f str)
802802 | f == Format "latex" || f == Format "tex"
803803 = return $ text str
804804 | otherwise = return empty
805−inlineToLaTeX (LineBreak) = return "\\\\"
805+inlineToLaTeX (LineBreak) = return $ "\\\\" <> cr
806806inlineToLaTeX Space = return space
807807inlineToLaTeX (Link txt ('#':ident, _)) = do
808808 contents <- inlineListToLaTeX txt
src/Text/Pandoc/Writers/MediaWiki.hs+1−1
@@ -375,7 +375,7 @@ inlineToMediaWiki (RawInline f str)
375375 | f == Format "html" = return str
376376 | otherwise = return ""
377377
378−inlineToMediaWiki (LineBreak) = return "<br />"
378+inlineToMediaWiki (LineBreak) = return "<br />\n"
379379
380380inlineToMediaWiki Space = return " "
381381
src/Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -370,7 +370,7 @@ inlineToOpenDocument :: WriterOptions -> Inline -> State WriterState Doc
370370inlineToOpenDocument o ils
371371 | Space <- ils = inTextStyle space
372372 | Span _ xs <- ils = inlinesToOpenDocument o xs
373− | LineBreak <- ils = return $ selfClosingTag "text:line-break" []
373+ | LineBreak <- ils = return $ selfClosingTag "text:line-break" [] <> cr
374374 | Str s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s
375375 | Emph l <- ils = withTextStyle Italic $ inlinesToOpenDocument o l
376376 | Strong l <- ils = withTextStyle Bold $ inlinesToOpenDocument o l
src/Text/Pandoc/Writers/Texinfo.hs+1−1
@@ -421,7 +421,7 @@ inlineToTexinfo (RawInline f str)
421421 return $ text "@tex" $$ text str $$ text "@end tex"
422422 | f == "texinfo" = return $ text str
423423 | otherwise = return empty
424−inlineToTexinfo (LineBreak) = return $ text "@*"
424+inlineToTexinfo (LineBreak) = return $ text "@*" <> cr
425425inlineToTexinfo Space = return $ char ' '
426426
427427inlineToTexinfo (Link txt (src@('#':_), _)) = do
tests/dokuwiki_inline_formatting.dokuwiki+2−1
@@ -6,7 +6,8 @@ Some people use single underlines for //emphasis//.
66
77Above the line is <sup>superscript</sup> and below the line is <sub>subscript</sub>.
88
9−A line\\ break.
9+A line\\
10+break.
1011
1112hello %%//%% world %%**%% from %%__%% me
1213
tests/writer.dokuwiki+2−1
@@ -36,7 +36,8 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Beca
3636
3737Here’s one with a bullet. * criminey.
3838
39−There should be a hard line break\\ here.
39+There should be a hard line break\\
40+here.
4041
4142
4243----
tests/writer.html+2−1
@@ -35,7 +35,8 @@
3535<p>Here’s a regular paragraph.</p>
3636<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
3737<p>Here’s one with a bullet. * criminey.</p>
38−<p>There should be a hard line break<br />here.</p>
38+<p>There should be a hard line break<br />
39+here.</p>
3940<hr />
4041<h1 id="block-quotes">Block Quotes</h1>
4142<p>E-mail style:</p>
tests/writer.latex+2−1
@@ -109,7 +109,8 @@ item.
109109
110110Here's one with a bullet. * criminey.
111111
112−There should be a hard line break\\here.
112+There should be a hard line break\\
113+here.
113114
114115\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
115116
tests/writer.mediawiki+2−1
@@ -36,7 +36,8 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Beca
3636
3737Here’s one with a bullet. * criminey.
3838
39−There should be a hard line break<br />here.
39+There should be a hard line break<br />
40+here.
4041
4142
4243-----
tests/writer.opendocument+2−1
@@ -896,7 +896,8 @@ of a paragraph looked like a list item.</text:p>
896896<text:p text:style-name="Text_20_body">Here’s one with a bullet. *
897897criminey.</text:p>
898898<text:p text:style-name="Text_20_body">There should be a hard line
899−break<text:line-break />here.</text:p>
899+break<text:line-break />
900+here.</text:p>
900901<text:p text:style-name="Horizontal_20_Line" />
901902<text:h text:style-name="Heading_20_1" text:outline-level="1">Block
902903Quotes</text:h>
tests/writer.texinfo+2−1
@@ -129,7 +129,8 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Beca
129129
130130Here's one with a bullet. * criminey.
131131
132−There should be a hard line break@*here.
132+There should be a hard line break@*
133+here.
133134
134135@iftex
135136@bigskip@hrule@bigskip