git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1925 from timtylin/patch/prettyLineBreaks
0a1cd25John MacFarlane
src/Text/Pandoc/Writers/DokuWiki.hs+1−1
@@ -459,7 +459,7 @@ inlineToDokuWiki _ (RawInline f str)
459 | f == Format "html" = return $ "<html>" ++ str ++ "</html>"
459 | f == Format "html" = return $ "<html>" ++ str ++ "</html>"
460 | otherwise = return ""
460 | otherwise = return ""
461
461
462−inlineToDokuWiki _ (LineBreak) = return "\\\\ "
462+inlineToDokuWiki _ (LineBreak) = return "\\\\\n"
463
463
464inlineToDokuWiki _ Space = return " "
464inlineToDokuWiki _ Space = return " "
465
465
src/Text/Pandoc/Writers/HTML.hs+2−1
@@ -656,7 +656,8 @@ inlineToHtml opts inline =
656 case inline of
656 case inline of
657 (Str str) -> return $ strToHtml str
657 (Str str) -> return $ strToHtml str
658 (Space) -> return $ strToHtml " "
658 (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"
660 (Span (id',classes,kvs) ils)
661 (Span (id',classes,kvs) ils)
661 -> inlineListToHtml opts ils >>=
662 -> inlineListToHtml opts ils >>=
662 return . addAttrs opts attr' . H.span
663 return . addAttrs opts attr' . H.span
src/Text/Pandoc/Writers/LaTeX.hs+1−1
@@ -802,7 +802,7 @@ inlineToLaTeX (RawInline f str)
802 | f == Format "latex" || f == Format "tex"
802 | f == Format "latex" || f == Format "tex"
803 = return $ text str
803 = return $ text str
804 | otherwise = return empty
804 | otherwise = return empty
805−inlineToLaTeX (LineBreak) = return "\\\\"
805+inlineToLaTeX (LineBreak) = return $ "\\\\" <> cr
806inlineToLaTeX Space = return space
806inlineToLaTeX Space = return space
807inlineToLaTeX (Link txt ('#':ident, _)) = do
807inlineToLaTeX (Link txt ('#':ident, _)) = do
808 contents <- inlineListToLaTeX txt
808 contents <- inlineListToLaTeX txt
src/Text/Pandoc/Writers/MediaWiki.hs+1−1
@@ -375,7 +375,7 @@ inlineToMediaWiki (RawInline f str)
375 | f == Format "html" = return str
375 | f == Format "html" = return str
376 | otherwise = return ""
376 | otherwise = return ""
377
377
378−inlineToMediaWiki (LineBreak) = return "<br />"
378+inlineToMediaWiki (LineBreak) = return "<br />\n"
379
379
380inlineToMediaWiki Space = return " "
380inlineToMediaWiki Space = return " "
381
381
src/Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -370,7 +370,7 @@ inlineToOpenDocument :: WriterOptions -> Inline -> State WriterState Doc
370inlineToOpenDocument o ils
370inlineToOpenDocument o ils
371 | Space <- ils = inTextStyle space
371 | Space <- ils = inTextStyle space
372 | Span _ xs <- ils = inlinesToOpenDocument o xs
372 | Span _ xs <- ils = inlinesToOpenDocument o xs
373− | LineBreak <- ils = return $ selfClosingTag "text:line-break" []
373+ | LineBreak <- ils = return $ selfClosingTag "text:line-break" [] <> cr
374 | Str s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s
374 | Str s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s
375 | Emph l <- ils = withTextStyle Italic $ inlinesToOpenDocument o l
375 | Emph l <- ils = withTextStyle Italic $ inlinesToOpenDocument o l
376 | Strong l <- ils = withTextStyle Bold $ inlinesToOpenDocument o l
376 | Strong l <- ils = withTextStyle Bold $ inlinesToOpenDocument o l
src/Text/Pandoc/Writers/Texinfo.hs+1−1
@@ -421,7 +421,7 @@ inlineToTexinfo (RawInline f str)
421 return $ text "@tex" $$ text str $$ text "@end tex"
421 return $ text "@tex" $$ text str $$ text "@end tex"
422 | f == "texinfo" = return $ text str
422 | f == "texinfo" = return $ text str
423 | otherwise = return empty
423 | otherwise = return empty
424−inlineToTexinfo (LineBreak) = return $ text "@*"
424+inlineToTexinfo (LineBreak) = return $ text "@*" <> cr
425inlineToTexinfo Space = return $ char ' '
425inlineToTexinfo Space = return $ char ' '
426
426
427inlineToTexinfo (Link txt (src@('#':_), _)) = do
427inlineToTexinfo (Link txt (src@('#':_), _)) = do
tests/dokuwiki_inline_formatting.dokuwiki+2−1
@@ -6,7 +6,8 @@ Some people use single underlines for //emphasis//.
6
6
7Above the line is <sup>superscript</sup> and below the line is <sub>subscript</sub>.
7Above the line is <sup>superscript</sup> and below the line is <sub>subscript</sub>.
8
8
9−A line\\ break.
9+A line\\
10+break.
10
11
11hello %%//%% world %%**%% from %%__%% me
12hello %%//%% world %%**%% from %%__%% me
12
13
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
36
36
37Here’s one with a bullet. * criminey.
37Here’s one with a bullet. * criminey.
38
38
39−There should be a hard line break\\ here.
39+There should be a hard line break\\
40+here.
40
41
41
42
42----
43----
tests/writer.html+2−1
@@ -35,7 +35,8 @@
35<p>Here’s a regular paragraph.</p>
35<p>Here’s a regular paragraph.</p>
36<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>
36<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>
37<p>Here’s one with a bullet. * criminey.</p>
37<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>
39<hr />
40<hr />
40<h1 id="block-quotes">Block Quotes</h1>
41<h1 id="block-quotes">Block Quotes</h1>
41<p>E-mail style:</p>
42<p>E-mail style:</p>
tests/writer.latex+2−1
@@ -109,7 +109,8 @@ item.
109
109
110Here's one with a bullet. * criminey.
110Here's one with a bullet. * criminey.
111
111
112−There should be a hard line break\\here.
112+There should be a hard line break\\
113+here.
113
114
114\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
115\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
115
116
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
36
36
37Here’s one with a bullet. * criminey.
37Here’s one with a bullet. * criminey.
38
38
39−There should be a hard line break<br />here.
39+There should be a hard line break<br />
40+here.
40
41
41
42
42-----
43-----
tests/writer.opendocument+2−1
@@ -896,7 +896,8 @@ of a paragraph looked like a list item.</text:p>
896<text:p text:style-name="Text_20_body">Here’s one with a bullet. *
896<text:p text:style-name="Text_20_body">Here’s one with a bullet. *
897criminey.</text:p>
897criminey.</text:p>
898<text:p text:style-name="Text_20_body">There should be a hard line
898<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>
900<text:p text:style-name="Horizontal_20_Line" />
901<text:p text:style-name="Horizontal_20_Line" />
901<text:h text:style-name="Heading_20_1" text:outline-level="1">Block
902<text:h text:style-name="Heading_20_1" text:outline-level="1">Block
902Quotes</text:h>
903Quotes</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
129
129
130Here's one with a bullet. * criminey.
130Here's one with a bullet. * criminey.
131
131
132−There should be a hard line break@*here.
132+There should be a hard line break@*
133+here.
133
134
134@iftex
135@iftex
135@bigskip@hrule@bigskip
136@bigskip@hrule@bigskip