Skip to content

Commit

Permalink
Add support for <permissions> metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kamoe authored and jgm committed Aug 28, 2023
1 parent f9153e8 commit 9d28e60
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Text/Pandoc/Readers/JATS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ parseMetadata e = do
getAffiliations e
getAbstract e
getPubDate e
getPermissions e
return mempty

getTitle :: PandocMonad m => Element -> JATS m ()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9d28e60

Please sign in to comment.