aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulia Diaz <[email protected]>2023-08-28 16:15:05 +0200
committerJohn MacFarlane <[email protected]>2023-08-28 08:33:57 -0700
commit9d28e6029f71f769756ee6d121822de5b0f2aed6 (patch)
treed9b3efb8c4985f35931a83fddc9c5b11d9b7c22f /src
parentf9153e86bbb0b0b5a6722dded757b43c59f3e057 (diff)
Add support for <permissions> metadata
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index 5a115f99b..8e603c29f 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -393,6 +393,7 @@ parseMetadata e = do
getAffiliations e
getAbstract e
getPubDate e
+ getPermissions e
return mempty
getTitle :: PandocMonad m => Element -> JATS m ()
@@ -457,6 +458,25 @@ getContrib x = do
then return $ given <> family
else return $ given <> space <> family
+getPermissions :: PandocMonad m => Element -> JATS m ()
+getPermissions e = do
+ statement <- case filterElement (named "copyright-statement") e of
+ Just s -> getInlines s
+ Nothing -> return mempty
+ year <- case filterElement (named "copyright-year") e of
+ Just s -> getInlines s
+ Nothing -> return mempty
+ holder <- case filterElement (named "copyright-holder") e of
+ Just s -> getInlines s
+ Nothing -> return mempty
+ license <- case filterElement (named "license") e of
+ Just s -> getBlocks s
+ Nothing -> return mempty
+ when (statement /= mempty) $ addMeta "copyright-statement" statement
+ when (year /= mempty) $ addMeta "copyright-year" year
+ when (holder /= mempty) $ addMeta "copyright-holder" holder
+ when (license /= mempty) $ addMeta "license" license
+
parseRefList :: PandocMonad m => Element -> JATS m Blocks
parseRefList e = do
refs <- mapM parseRef $ filterChildren (named "ref") e