From 790dc2546b965853dbcaa8db1a36dd05b147ef85 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 23 Dec 2017 10:20:13 -0800 Subject: JATS reader: include institute metadata. --- src/Text/Pandoc/Readers/JATS.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs index 29c443d86..dcc412a63 100644 --- a/src/Text/Pandoc/Readers/JATS.hs +++ b/src/Text/Pandoc/Readers/JATS.hs @@ -248,7 +248,13 @@ parseBlock (Elem e) = authors <- mapM getContrib $ filterChildren (\x -> named "contrib" x && attrValue "contrib-type" x == "author") e - unless (null authors) $ addMeta "author" authors + unless (null authors) $ + addMeta "author" authors + + getAffiliations :: PandocMonad m => Element -> JATS m () + getAffiliations x = do + affs <- mapM getInlines $ filterChildren (named "aff") x + unless (null affs) $ addMeta "institute" affs getContrib :: PandocMonad m => Element -> JATS m Inlines getContrib x = do @@ -328,7 +334,10 @@ parseBlock (Elem e) = modify $ \st -> st{ jatsSectionLevel = oldN } return $ headerWith (ident,[],[]) n' headerText <> b -- lineItems = mapM getInlines $ filterChildren (named "line") e - metaBlock = acceptingMetadata (getBlocks e) >> return mempty + metaBlock = do + acceptingMetadata (getBlocks e) + getAffiliations e + return mempty getInlines :: PandocMonad m => Element -> JATS m Inlines getInlines e' = (trimInlines . mconcat) <$> -- cgit v1.2.3