diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2017-10-31 20:16:22 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2017-10-31 20:19:00 +0300 |
commit | a496979c6d0eb3e6efd57264cb89d4aad1f7afdb (patch) | |
tree | 04d3423c1a2ebd1b44664e7c3254294e77b7abb0 /src/Text | |
parent | 3eaa6ff329b079387d70449a8236d1b83b95e3bf (diff) | |
download | pandoc-a496979c6d0eb3e6efd57264cb89d4aad1f7afdb.tar.gz |
FB2 writer: write blocks outside of <p> in definitions
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/FB2.hs | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs index cf96393ca..0a8ae17bb 100644 --- a/src/Text/Pandoc/Writers/FB2.hs +++ b/src/Text/Pandoc/Writers/FB2.hs @@ -362,17 +362,9 @@ blockToXml (DefinitionList defs) = cMapM mkdef defs where mkdef (term, bss) = do - def' <- cMapM (cMapM blockToXml . sep . paraToPlain . map indent) bss + items <- cMapM (cMapM blockToXml . plainToPara . indentBlocks (replicate 4 ' ')) bss t <- wrap "strong" term - return [ el "p" t, el "p" def' ] - sep blocks = - if all needsBreak blocks then - blocks ++ [Plain [LineBreak]] - else - blocks - needsBreak (Para _) = False - needsBreak (Plain ins) = LineBreak `notElem` ins - needsBreak _ = True + return (el "p" t : items) blockToXml h@Header{} = do -- should not occur after hierarchicalize, except inside lists/blockquotes report $ BlockNotRendered h @@ -403,14 +395,6 @@ blockToXml (Table caption aligns _ headers rows) = do align_str AlignDefault = "left" blockToXml Null = return [] --- Replace paragraphs with plain text and line break. --- Necessary to simulate multi-paragraph lists in FB2. -paraToPlain :: [Block] -> [Block] -paraToPlain [] = [] -paraToPlain (Para inlines : rest) = - Plain inlines : Plain [LineBreak] : paraToPlain rest -paraToPlain (p:rest) = p : paraToPlain rest - -- Replace plain text with paragraphs and add line break after paragraphs. -- It is used to convert plain text from tight list items to paragraphs. plainToPara :: [Block] -> [Block] |