diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-10-13 11:38:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-13 11:38:19 +0200 |
commit | 4eff6076788d6852974985a0bfcbf73c4d12244e (patch) | |
tree | d9b882c7c0d14195385033cf305f15148d08f318 /src/Text/Pandoc/Writers/AsciiDoc.hs | |
parent | cbeb72d06b4eb3718479eba5257a33a385f642fe (diff) | |
parent | 63966f6375d22557d0873ba088205ba192d3f9f9 (diff) | |
download | pandoc-4eff6076788d6852974985a0bfcbf73c4d12244e.tar.gz |
Merge pull request #3072 from tarleb/lineblock
Read and write LineBlock elements
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 - |