diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2016-10-13 08:46:44 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2016-10-13 08:46:44 +0200 |
commit | 22cb9e3327ff4aea6109c048a185506e67f07ef1 (patch) | |
tree | f3d18ed0fcfa1c0ad273730151dbc80329590da6 /src/Text/Pandoc/Writers/AsciiDoc.hs | |
parent | 64b77cc2c5aa9db5432f616f49a660ec9dbbcc9f (diff) | |
download | pandoc-22cb9e3327ff4aea6109c048a185506e67f07ef1.tar.gz |
Add support for the LineBlock element to writers
The following markup features are used to output the lines of the `LineBlock`
element:
- AsciiDoc: a `[verse]` block,
- ConTeXt: text surrounded by `\startlines` and `\endlines`,
- HTML: `div` with an per-element style setting to interpret the content as
pre-wrapped,
- Markdown: line blocks if the `line_blocks` extension is enabled, a simple
paragraph with hard linebreaks otherwise,
- Org: VERSE block,
- RST: a line block, and
- all other formats: a paragraph, containing hard linebreaks between lines.
Custom lua writers should be updated to use the `LineBlock` element.
Diffstat (limited to 'src/Text/Pandoc/Writers/AsciiDoc.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/AsciiDoc.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index 0dfbd705e..c7097c368 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -137,6 +137,13 @@ blockToAsciiDoc opts (Para inlines) = do then text "\\" else empty return $ esc <> contents <> blankline +blockToAsciiDoc opts (LineBlock lns) = do + let docify line = if null line + then return blankline + else inlineListToAsciiDoc opts line + let joinWithLinefeeds = nowrap . mconcat . intersperse cr + contents <- joinWithLinefeeds <$> mapM docify lns + return $ "[verse]" $$ text "--" $$ contents $$ text "--" $$ blankline blockToAsciiDoc _ (RawBlock f s) | f == "asciidoc" = return $ text s | otherwise = return empty @@ -459,4 +466,3 @@ inlineToAsciiDoc opts (Span (ident,_,_) ils) = do let identifier = if (null ident) then empty else ("[[" <> text ident <> "]]") contents <- inlineListToAsciiDoc opts ils return $ identifier <> contents - |