git.iko.soy/typeable/pandoc
on master help sign in
Pass the parsed DocBook content along the state of readDocBook
f653814Frerich Raabe
src/Text/Pandoc/Readers/DocBook.hs+4−2
@@ -511,6 +511,7 @@ data DBState = DBState{ dbSectionLevel :: Int
511 , dbAcceptsMeta :: Bool
511 , dbAcceptsMeta :: Bool
512 , dbBook :: Bool
512 , dbBook :: Bool
513 , dbFigureTitle :: Inlines
513 , dbFigureTitle :: Inlines
514+ , dbContent :: [Content]
514 } deriving Show
515 } deriving Show
515
516
516instance Default DBState where
517instance Default DBState where
@@ -519,12 +520,13 @@ instance Default DBState where
519 , dbMeta = mempty
520 , dbMeta = mempty
520 , dbAcceptsMeta = False
521 , dbAcceptsMeta = False
521 , dbBook = False
522 , dbBook = False
522− , dbFigureTitle = mempty }
523+ , dbFigureTitle = mempty
524+ , dbContent = [] }
523
525
524
526
525readDocBook :: ReaderOptions -> String -> Either PandocError Pandoc
527readDocBook :: ReaderOptions -> String -> Either PandocError Pandoc
526readDocBook _ inp = (\blocks -> Pandoc (dbMeta st') (toList . mconcat $ blocks)) <$> bs
528readDocBook _ inp = (\blocks -> Pandoc (dbMeta st') (toList . mconcat $ blocks)) <$> bs
527− where (bs , st') = flip runState def . runExceptT . mapM parseBlock $ tree
529+ where (bs , st') = flip runState (def{ dbContent = tree }) . runExceptT . mapM parseBlock $ tree
528 tree = normalizeTree . parseXML . handleInstructions $ inp
530 tree = normalizeTree . parseXML . handleInstructions $ inp
529
531
530-- We treat <?asciidoc-br?> specially (issue #1236), converting it
532-- We treat <?asciidoc-br?> specially (issue #1236), converting it