summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-23 10:20:13 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-23 10:20:13 -0800
commit790dc2546b965853dbcaa8db1a36dd05b147ef85 (patch)
treecffe5cd76b2b10a2c381eb0759165de3613ff635 /src
parent6b63b63f30c8d03575d99f300cca6e54b78d42eb (diff)
JATS reader: include institute metadata.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs13
1 files changed, 11 insertions, 2 deletions
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) <$>