From 00013c21eb10dc15b8edad9c0d5ec07622855ba0 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 9 Oct 2017 05:38:02 +0300 Subject: FB2 Writer: format LineBlock as poem Previously writer produced one paragraph with elements, which are not allowed inside

according to FB2 schema. --- src/Text/Pandoc/Writers/FB2.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3