aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/FB2.hs
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-10-09 05:38:02 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2017-10-11 12:34:02 +0300
commit00013c21eb10dc15b8edad9c0d5ec07622855ba0 (patch)
tree515dc305411b86a862e72f8a7e3e74d5e41ba533 /src/Text/Pandoc/Writers/FB2.hs
parent0ff96117d3193983882fd8ff7b925ad110b96566 (diff)
downloadpandoc-00013c21eb10dc15b8edad9c0d5ec07622855ba0.tar.gz
FB2 Writer: format LineBlock as poem
Previously writer produced one paragraph with <empty-line/> elements, which are not allowed inside <p> according to FB2 schema.
Diffstat (limited to 'src/Text/Pandoc/Writers/FB2.hs')
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 736e95636..9cb9098de 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -56,7 +56,7 @@ import qualified Text.Pandoc.Class as P
import Text.Pandoc.Definition
import Text.Pandoc.Logging
import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..), def)
-import Text.Pandoc.Shared (capitalize, isHeaderBlock, isURI, linesToPara,
+import Text.Pandoc.Shared (capitalize, isHeaderBlock, isURI,
orderedListMarkers)
-- | Data to be written at the end of the document:
@@ -331,7 +331,11 @@ blockToXml b@(RawBlock _ _) = do
return []
blockToXml (Div _ bs) = cMapM blockToXml bs
blockToXml (BlockQuote bs) = (list . el "cite") <$> cMapM blockToXml bs
-blockToXml (LineBlock lns) = blockToXml $ linesToPara lns
+blockToXml (LineBlock lns) =
+ (list . el "poem") <$> mapM stanza (split null lns)
+ where
+ v xs = el "v" <$> cMapM toXml xs
+ stanza xs = el "stanza" <$> mapM v xs
blockToXml (OrderedList a bss) = do
state <- get
let pmrk = parentListMarker state