diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-03-28 18:50:03 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-03-28 18:50:03 -0700 |
| commit | 807a574e9d33fcf66928388e342cc1436eb2346e (patch) | |
| tree | dc63cdcd096984002715ca0244bab74e7112c7f8 /src | |
| parent | 51c8b059e1710cc7301b4daa379bb3b66847d00e (diff) | |
JATS reader: strip 'ref-' from ref id in constructing CSL id.
This allows better round-tripping, because the JATS
writer adds the `ref-` prefix to the citation id to get
the ref element's id.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/JATS.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs index 98cf5bdf5..2dee2bab3 100644 --- a/src/Text/Pandoc/Readers/JATS.hs +++ b/src/Text/Pandoc/Readers/JATS.hs @@ -460,7 +460,10 @@ parseRef e = do x -> x) :) . catMaybes <$> mapM (refElement c) (elChildren c) Nothing -> pure [] -- TODO handle mixed-citation - return $ Map.fromList (("id", toMetaValue $ attrValue "id" e) : refVariables) + -- allows round-tripping, since JATS writer puts ref- in front of citation ids: + let stripPref t = fromMaybe t $ T.stripPrefix "ref-" t + return $ Map.fromList (("id", toMetaValue $ stripPref $ attrValue "id" e) + : refVariables) textContent :: Element -> Text textContent = strContent |
