From 692f88fd8fd343478428407a21a71b3d1e9cdbe8 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 11 May 2019 09:51:19 +0300 Subject: Reduce the amount of state in FB2 reader --- src/Text/Pandoc/Readers/FB2.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/FB2.hs b/src/Text/Pandoc/Readers/FB2.hs index cc10913e2..484d5ceb8 100644 --- a/src/Text/Pandoc/Readers/FB2.hs +++ b/src/Text/Pandoc/Readers/FB2.hs @@ -62,7 +62,9 @@ instance HasMeta FB2State where readFB2 :: PandocMonad m => ReaderOptions -> Text -> m Pandoc readFB2 _ inp = do - (bs, st) <- runStateT (mapM parseBlock $ parseXML (crFilter inp)) def + let parsedXml = parseXML $ crFilter inp + + (bs, st) <- runStateT (mapM parseBlock $ parsedXml) def let authors = if null $ fb2Authors st then id else setMeta "author" (map text $ reverse $ fb2Authors st) -- cgit v1.2.3