Org reader: fix bug in org-ref citation parsing.
The org-ref syntax allows to list multiple citations separated by comma. This fixes a bug that accepted commas as part of the citation id, so all citation lists were parsed as one single citation. Fixes: #7101
This commit is contained in:
parent
ef741f3842
commit
743f7216de
2 changed files with 41 additions and 1 deletions
|
@ -322,7 +322,7 @@ linkLikeOrgRefCite = try $ do
|
|||
-- from the `org-ref-cite-re` variable in `org-ref.el`.
|
||||
orgRefCiteKey :: PandocMonad m => OrgParser m Text
|
||||
orgRefCiteKey =
|
||||
let citeKeySpecialChars = "-_:\\./," :: String
|
||||
let citeKeySpecialChars = "-_:\\./" :: String
|
||||
isCiteKeySpecialChar c = c `elem` citeKeySpecialChars
|
||||
isCiteKeyChar c = isAlphaNum c || isCiteKeySpecialChar c
|
||||
endOfCitation = try $ do
|
||||
|
|
|
@ -116,6 +116,46 @@ tests =
|
|||
}
|
||||
in (para $ cite [citation] "citep:pandoc")
|
||||
|
||||
, "multiple simple citations" =:
|
||||
"citep:picard,riker" =?>
|
||||
let picard = Citation
|
||||
{ citationId = "picard"
|
||||
, citationPrefix = mempty
|
||||
, citationSuffix = mempty
|
||||
, citationMode = NormalCitation
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0
|
||||
}
|
||||
riker = Citation
|
||||
{ citationId = "riker"
|
||||
, citationPrefix = mempty
|
||||
, citationSuffix = mempty
|
||||
, citationMode = NormalCitation
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0
|
||||
}
|
||||
in (para $ cite [picard,riker] "citep:picard,riker")
|
||||
|
||||
, "multiple simple citations succeeded by comma" =:
|
||||
"citep:picard,riker," =?>
|
||||
let picard = Citation
|
||||
{ citationId = "picard"
|
||||
, citationPrefix = mempty
|
||||
, citationSuffix = mempty
|
||||
, citationMode = NormalCitation
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0
|
||||
}
|
||||
riker = Citation
|
||||
{ citationId = "riker"
|
||||
, citationPrefix = mempty
|
||||
, citationSuffix = mempty
|
||||
, citationMode = NormalCitation
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0
|
||||
}
|
||||
in (para $ cite [picard,riker] "citep:picard,riker" <> str ",")
|
||||
|
||||
, "extended citation" =:
|
||||
"[[citep:Dominik201408][See page 20::, for example]]" =?>
|
||||
let citation = Citation
|
||||
|
|
Loading…
Reference in a new issue