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.
This commit is contained in:
parent
51c8b059e1
commit
807a574e9d
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue