@@ -55,7 +55,6 @@ import Control.Monad.State
5555import Text.XML.Light hiding (ppTopElement)
5656import Text.Pandoc.UUID
5757import Text.Pandoc.Writers.HTML
58−import Text.Pandoc.Writers.Markdown ( writePlain )
5958import Data.Char ( toLower, isDigit, isAlphaNum )
6059import Network.URI ( unEscapeString )
6160import Text.Pandoc.MIME (getMimeType)
@@ -124,20 +123,15 @@ dcNode = node . dcName
124123opfName :: String -> QName
125124opfName n = QName n Nothing (Just "opf")
126125
127−plainify :: [Inline] -> String
128−plainify t =
129− trimr $ writePlain def{ writerStandalone = False }
130− $ Pandoc nullMeta [Plain $ walk removeNote t]
131−
132−removeNote :: Inline -> Inline
133−removeNote (Note _) = Str ""
134−removeNote x = x
135−
136126toId :: FilePath -> String
137127toId = map (\x -> if isAlphaNum x || x == '-' || x == '_'
138128 then x
139129 else '_') . takeFileName
140130
131+removeNote :: Inline -> Inline
132+removeNote (Note _) = Str ""
133+removeNote x = x
134+
141135getEPUBMetadata :: WriterOptions -> Meta -> IO EPUBMetadata
142136getEPUBMetadata opts meta = do
143137 let md = metadataFromMeta opts meta
@@ -172,7 +166,7 @@ getEPUBMetadata opts meta = do
172166 if any (\c -> creatorRole c == Just "aut") $ epubCreator m
173167 then return m
174168 else do
175− let authors' = map plainify $ docAuthors meta
169+ let authors' = map stringify $ docAuthors meta
176170 let toAuthor name = Creator{ creatorText = name
177171 , creatorRole = Just "aut"
178172 , creatorFileAs = Nothing }
@@ -221,8 +215,8 @@ addMetadataFromXML _ md = md
221215
222216metaValueToString :: MetaValue -> String
223217metaValueToString (MetaString s) = s
224−metaValueToString (MetaInlines ils) = plainify ils
225−metaValueToString (MetaBlocks bs) = plainify $ query (:[]) bs
218+metaValueToString (MetaInlines ils) = stringify ils
219+metaValueToString (MetaBlocks bs) = stringify bs
226220metaValueToString (MetaBool b) = show b
227221metaValueToString _ = ""
228222
@@ -468,7 +462,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
468462 [] -> case epubTitle metadata of
469463 [] -> "UNTITLED"
470464 (x:_) -> titleText x
471− x -> plainify x
465+ x -> stringify x
472466 let uuid = case epubIdentifier metadata of
473467 (x:_) -> identifierText x -- use first identifier as UUID
474468 [] -> error "epubIdentifier is null" -- shouldn't happen
@@ -535,7 +529,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
535529 modify (+1)
536530 let showNums :: [Int] -> String
537531 showNums = intercalate "." . map show
538− let tit' = plainify ils
532+ let tit' = stringify ils
539533 let tit = if writerNumberSections opts && not (null nums)
540534 then showNums nums ++ " " ++ tit'
541535 else tit'
@@ -558,7 +552,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
558552 ] ++ subs
559553
560554 let tpNode = unode "navPoint" ! [("id", "navPoint-0")] $
561− [ unode "navLabel" $ unode "text" (plainify $ docTitle meta)
555+ [ unode "navLabel" $ unode "text" (stringify $ docTitle meta)
562556 , unode "content" ! [("src","title_page.xhtml")] $ () ]
563557
564558 let tocData = UTF8.fromStringLazy $ ppTopElement $