git.iko.soy/typeable/pandoc
on master help sign in
Reduce the amount of state in FB2 reader
692f88fAlexander Krotov
src/Text/Pandoc/Readers/FB2.hs+3−1
@@ -62,7 +62,9 @@ instance HasMeta FB2State where
62
62
63readFB2 :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
63readFB2 :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
64readFB2 _ inp = do
64readFB2 _ inp = do
65+ let parsedXml = parseXML $ crFilter inp
66+
65− (bs, st) <- runStateT (mapM parseBlock $ parseXML (crFilter inp)) def
67+ (bs, st) <- runStateT (mapM parseBlock $ parsedXml) def
66 let authors = if null $ fb2Authors st
68 let authors = if null $ fb2Authors st
67 then id
69 then id
68 else setMeta "author" (map text $ reverse $ fb2Authors st)
70 else setMeta "author" (map text $ reverse $ fb2Authors st)