From f1aaad9e86023dd90423681494dd24c48758c76f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 1 May 2015 22:36:38 -0700 Subject: EPUB writer: Use plain writer for metadata dc: fields. This gives better results when we have, e.g. multiple paragraphs. Note that tags aren't allowed in these fields. Closes #2121. --- src/Text/Pandoc/Writers/EPUB.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers/EPUB.hs') diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 9c6085a76..37c285dc2 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -57,6 +57,8 @@ import Text.Pandoc.Options ( WriterOptions(..) , ObfuscationMethod(NoObfuscation) ) import Text.Pandoc.Definition import Text.Pandoc.Walk (walk, walkM) +import Data.Default +import Text.Pandoc.Writers.Markdown (writePlain) import Control.Monad.State (modify, get, execState, State, put, evalState) import Control.Monad (foldM, mplus, liftM, when) import Text.XML.Light ( unode, Element(..), unqual, Attr(..), add_attrs @@ -226,8 +228,9 @@ addMetadataFromXML _ md = md metaValueToString :: MetaValue -> String metaValueToString (MetaString s) = s -metaValueToString (MetaInlines ils) = stringify ils -metaValueToString (MetaBlocks bs) = stringify bs +metaValueToString (MetaInlines ils) = writePlain def + (Pandoc nullMeta [Plain ils]) +metaValueToString (MetaBlocks bs) = writePlain def (Pandoc nullMeta bs) metaValueToString (MetaBool b) = show b metaValueToString _ = "" -- cgit v1.2.3