git.iko.soy/typeable/pandoc
on master help sign in
Added recognition of authorgroup element and releaseinfo element to DocBook reader.
1b930a9Matthew Pickering
src/Text/Pandoc/Readers/DocBook.hs+16−9
@@ -45,7 +45,7 @@ List of all DocBook tags, with [x] indicating implemented,
45[ ] audioobject - A wrapper for audio data and its associated meta-information
45[ ] audioobject - A wrapper for audio data and its associated meta-information
46[x] author - The name of an individual author
46[x] author - The name of an individual author
47[ ] authorblurb - A short description or note about an author
47[ ] authorblurb - A short description or note about an author
48−[ ] authorgroup - Wrapper for author information when a document has
48+[x] authorgroup - Wrapper for author information when a document has
49 multiple authors or collabarators
49 multiple authors or collabarators
50[x] authorinitials - The initials or other short identifier for an author
50[x] authorinitials - The initials or other short identifier for an author
51[o] beginpage - The location of a page break in a print version of the document
51[o] beginpage - The location of a page break in a print version of the document
@@ -341,7 +341,7 @@ List of all DocBook tags, with [x] indicating implemented,
341[x] refsectioninfo - Meta-information for a refsection
341[x] refsectioninfo - Meta-information for a refsection
342[ ] refsynopsisdiv - A syntactic synopsis of the subject of the reference page
342[ ] refsynopsisdiv - A syntactic synopsis of the subject of the reference page
343[ ] refsynopsisdivinfo - Meta-information for a RefSynopsisDiv
343[ ] refsynopsisdivinfo - Meta-information for a RefSynopsisDiv
344−[ ] releaseinfo - Information about a particular release of a document
344+[x] releaseinfo - Information about a particular release of a document
345[ ] remark - A remark (or comment) intended for presentation in a draft
345[ ] remark - A remark (or comment) intended for presentation in a draft
346 manuscript
346 manuscript
347[ ] replaceable - Content that may or must be replaced by the user
347[ ] replaceable - Content that may or must be replaced by the user
@@ -564,10 +564,11 @@ acceptingMetadata p = do
564 modify (\s -> s { dbAcceptsMeta = False })
564 modify (\s -> s { dbAcceptsMeta = False })
565 return res
565 return res
566
566
567−checkInMeta :: Monoid a => DB a -> DB a
567+checkInMeta :: Monoid a => DB () -> DB a
568checkInMeta p = do
568checkInMeta p = do
569 accepts <- dbAcceptsMeta <$> get
569 accepts <- dbAcceptsMeta <$> get
570+ when accepts p
570− if accepts then p else return mempty
571+ return mempty
571
572
572
573
573
574
@@ -649,9 +650,11 @@ parseBlock (Elem e) =
649 "attribution" -> return mempty
650 "attribution" -> return mempty
650 "titleabbrev" -> return mempty
651 "titleabbrev" -> return mempty
651 "authorinitials" -> return mempty
652 "authorinitials" -> return mempty
652− "title" -> checkInMeta getTitle >> return mempty -- handled by getTitle or sect or figure
653+ "title" -> checkInMeta getTitle
653− "author" -> checkInMeta getAuthor >> return mempty
654+ "author" -> checkInMeta getAuthor
655+ "authorgroup" -> checkInMeta getAuthorGroup
656+ "releaseinfo" -> checkInMeta (getInlines e >>= addMeta "release")
654− "date" -> checkInMeta getDate >> return mempty
657+ "date" -> checkInMeta getDate
655 "bibliography" -> sect 0
658 "bibliography" -> sect 0
656 "bibliodiv" -> sect 1
659 "bibliodiv" -> sect 1
657 "biblioentry" -> parseMixed para (elContent e)
660 "biblioentry" -> parseMixed para (elContent e)
@@ -786,7 +789,10 @@ parseBlock (Elem e) =
786 Nothing -> return mempty
789 Nothing -> return mempty
787 addMeta "title" (tit <> subtit)
790 addMeta "title" (tit <> subtit)
788
791
789− getAuthor = getInlines e >>= addMeta "author"
792+ getAuthor = (:[]) <$> getInlines e >>= addMeta "authors"
793+ getAuthorGroup = do
794+ let terms = filterChildren (named "author") e
795+ mapM getInlines terms >>= addMeta "authors"
790 getDate = getInlines e >>= addMeta "date"
796 getDate = getInlines e >>= addMeta "date"
791 parseTable = do
797 parseTable = do
792 let isCaption x = named "title" x || named "caption" x
798 let isCaption x = named "title" x || named "caption" x
@@ -849,7 +855,7 @@ parseBlock (Elem e) =
849 b <- getBlocks e
855 b <- getBlocks e
850 modify $ \st -> st{ dbSectionLevel = n - 1 }
856 modify $ \st -> st{ dbSectionLevel = n - 1 }
851 return $ header n' headerText <> b
857 return $ header n' headerText <> b
852− metaBlock = acceptingMetadata (getBlocks e)
858+ metaBlock = acceptingMetadata (getBlocks e) >> return mempty
853
859
854getInlines :: Element -> DB Inlines
860getInlines :: Element -> DB Inlines
855getInlines e' = (trimInlines . mconcat) <$> (mapM parseInline $ elContent e')
861getInlines e' = (trimInlines . mconcat) <$> (mapM parseInline $ elContent e')
@@ -913,6 +919,7 @@ parseInline (Elem e) =
913 _ -> emph <$> innerInlines
919 _ -> emph <$> innerInlines
914 "footnote" -> (note . mconcat) <$> (mapM parseBlock $ elContent e)
920 "footnote" -> (note . mconcat) <$> (mapM parseBlock $ elContent e)
915 "title" -> return mempty
921 "title" -> return mempty
922+ "affiliation" -> return mempty
916 _ -> innerInlines
923 _ -> innerInlines
917 where innerInlines = (trimInlines . mconcat) <$>
924 where innerInlines = (trimInlines . mconcat) <$>
918 (mapM parseInline $ elContent e)
925 (mapM parseInline $ elContent e)