diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-02-07 20:21:58 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-02-07 20:21:58 -0800 |
commit | 0a1cd2531243d2fd82e442448602705ac9174873 (patch) | |
tree | d9ee294bfe88e14932b84dae8f42525d2ea0d9a0 | |
parent | fb7a03dcda6872e5f41c16783dc66244805ac44a (diff) | |
parent | 0c18f3a854efaba54367f66d0f572afcab7d57f0 (diff) | |
download | pandoc-0a1cd2531243d2fd82e442448602705ac9174873.tar.gz |
Merge pull request #1925 from timtylin/patch/prettyLineBreaks
Append newline to the LineBreak of various writers
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 3 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/MediaWiki.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Texinfo.hs | 2 | ||||
-rw-r--r-- | tests/dokuwiki_inline_formatting.dokuwiki | 3 | ||||
-rw-r--r-- | tests/writer.dokuwiki | 3 | ||||
-rw-r--r-- | tests/writer.html | 3 | ||||
-rw-r--r-- | tests/writer.latex | 3 | ||||
-rw-r--r-- | tests/writer.mediawiki | 3 | ||||
-rw-r--r-- | tests/writer.opendocument | 3 | ||||
-rw-r--r-- | tests/writer.texinfo | 3 |
13 files changed, 21 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index eed45a965..17ff8a279 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -459,7 +459,7 @@ inlineToDokuWiki _ (RawInline f str) | f == Format "html" = return $ "<html>" ++ str ++ "</html>" | otherwise = return "" -inlineToDokuWiki _ (LineBreak) = return "\\\\ " +inlineToDokuWiki _ (LineBreak) = return "\\\\\n" inlineToDokuWiki _ Space = return " " diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 1ae951e46..ef00ea036 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -656,7 +656,8 @@ inlineToHtml opts inline = case inline of (Str str) -> return $ strToHtml str (Space) -> return $ strToHtml " " - (LineBreak) -> return $ if writerHtml5 opts then H5.br else H.br + (LineBreak) -> return $ (if writerHtml5 opts then H5.br else H.br) + <> strToHtml "\n" (Span (id',classes,kvs) ils) -> inlineListToHtml opts ils >>= return . addAttrs opts attr' . H.span diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index d50ccb655..0e5ec5c18 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -802,7 +802,7 @@ inlineToLaTeX (RawInline f str) | f == Format "latex" || f == Format "tex" = return $ text str | otherwise = return empty -inlineToLaTeX (LineBreak) = return "\\\\" +inlineToLaTeX (LineBreak) = return $ "\\\\" <> cr inlineToLaTeX Space = return space inlineToLaTeX (Link txt ('#':ident, _)) = do contents <- inlineListToLaTeX txt diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index 4f03ee3bb..ccb39e295 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -375,7 +375,7 @@ inlineToMediaWiki (RawInline f str) | f == Format "html" = return str | otherwise = return "" -inlineToMediaWiki (LineBreak) = return "<br />" +inlineToMediaWiki (LineBreak) = return "<br />\n" inlineToMediaWiki Space = return " " diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index 901f827fb..865b7fb35 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -370,7 +370,7 @@ inlineToOpenDocument :: WriterOptions -> Inline -> State WriterState Doc inlineToOpenDocument o ils | Space <- ils = inTextStyle space | Span _ xs <- ils = inlinesToOpenDocument o xs - | LineBreak <- ils = return $ selfClosingTag "text:line-break" [] + | LineBreak <- ils = return $ selfClosingTag "text:line-break" [] <> cr | Str s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s | Emph l <- ils = withTextStyle Italic $ inlinesToOpenDocument o l | Strong l <- ils = withTextStyle Bold $ inlinesToOpenDocument o l diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs index 8fd177fd3..cf736ebda 100644 --- a/src/Text/Pandoc/Writers/Texinfo.hs +++ b/src/Text/Pandoc/Writers/Texinfo.hs @@ -421,7 +421,7 @@ inlineToTexinfo (RawInline f str) return $ text "@tex" $$ text str $$ text "@end tex" | f == "texinfo" = return $ text str | otherwise = return empty -inlineToTexinfo (LineBreak) = return $ text "@*" +inlineToTexinfo (LineBreak) = return $ text "@*" <> cr inlineToTexinfo Space = return $ char ' ' inlineToTexinfo (Link txt (src@('#':_), _)) = do diff --git a/tests/dokuwiki_inline_formatting.dokuwiki b/tests/dokuwiki_inline_formatting.dokuwiki index dd5cb52b4..262094184 100644 --- a/tests/dokuwiki_inline_formatting.dokuwiki +++ b/tests/dokuwiki_inline_formatting.dokuwiki @@ -6,7 +6,8 @@ Some people use single underlines for //emphasis//. Above the line is <sup>superscript</sup> and below the line is <sub>subscript</sub>. -A line\\ break. +A line\\ +break. hello %%//%% world %%**%% from %%__%% me diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki index dc14e9b00..2c3c9b1b5 100644 --- a/tests/writer.dokuwiki +++ b/tests/writer.dokuwiki @@ -36,7 +36,8 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Beca Here’s one with a bullet. * criminey. -There should be a hard line break\\ here. +There should be a hard line break\\ +here. ---- diff --git a/tests/writer.html b/tests/writer.html index 6f7d1764b..1357fa7c4 100644 --- a/tests/writer.html +++ b/tests/writer.html @@ -35,7 +35,8 @@ <p>Here’s a regular paragraph.</p> <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> <p>Here’s one with a bullet. * criminey.</p> -<p>There should be a hard line break<br />here.</p> +<p>There should be a hard line break<br /> +here.</p> <hr /> <h1 id="block-quotes">Block Quotes</h1> <p>E-mail style:</p> diff --git a/tests/writer.latex b/tests/writer.latex index 5b41bac75..f7123be98 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -109,7 +109,8 @@ item. Here's one with a bullet. * criminey. -There should be a hard line break\\here. +There should be a hard line break\\ +here. \begin{center}\rule{0.5\linewidth}{\linethickness}\end{center} diff --git a/tests/writer.mediawiki b/tests/writer.mediawiki index efd43cb04..b8b99c5e7 100644 --- a/tests/writer.mediawiki +++ b/tests/writer.mediawiki @@ -36,7 +36,8 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Beca Here’s one with a bullet. * criminey. -There should be a hard line break<br />here. +There should be a hard line break<br /> +here. ----- diff --git a/tests/writer.opendocument b/tests/writer.opendocument index 81c793a62..ac436150d 100644 --- a/tests/writer.opendocument +++ b/tests/writer.opendocument @@ -896,7 +896,8 @@ of a paragraph looked like a list item.</text:p> <text:p text:style-name="Text_20_body">Here’s one with a bullet. * criminey.</text:p> <text:p text:style-name="Text_20_body">There should be a hard line -break<text:line-break />here.</text:p> +break<text:line-break /> +here.</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Block Quotes</text:h> diff --git a/tests/writer.texinfo b/tests/writer.texinfo index 7b59ea651..c5eb9748a 100644 --- a/tests/writer.texinfo +++ b/tests/writer.texinfo @@ -129,7 +129,8 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Beca Here's one with a bullet. * criminey. -There should be a hard line break@*here. +There should be a hard line break@* +here. @iftex @bigskip@hrule@bigskip |