Merge pull request #1954 from mcmtroffaes/feature/citekey-firstchar-alphanum
Allow digit as first character of a citation key.
This commit is contained in:
commit
28ca8566ab
3 changed files with 24 additions and 2 deletions
2
README
2
README
|
@ -2733,7 +2733,7 @@ modifying CSL styles can be found at
|
|||
Citations go inside square brackets and are separated by semicolons.
|
||||
Each citation must have a key, composed of '@' + the citation
|
||||
identifier from the database, and may optionally have a prefix,
|
||||
a locator, and a suffix. The citation key must begin with a letter
|
||||
a locator, and a suffix. The citation key must begin with a letter, digit,
|
||||
or `_`, and may contain alphanumerics, `_`, and internal punctuation
|
||||
characters (`:.#$%&-+?<>~/`). Here are some examples:
|
||||
|
||||
|
|
|
@ -1191,7 +1191,7 @@ citeKey = try $ do
|
|||
guard =<< notAfterString
|
||||
suppress_author <- option False (char '-' *> return True)
|
||||
char '@'
|
||||
firstChar <- letter <|> char '_'
|
||||
firstChar <- alphaNum <|> char '_'
|
||||
let regchar = satisfy (\c -> isAlphaNum c || c == '_')
|
||||
let internal p = try $ p <* lookAhead regchar
|
||||
rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/")
|
||||
|
|
|
@ -293,4 +293,26 @@ tests = [ testGroup "inline code"
|
|||
, plain "b"
|
||||
, plain "c" <> bulletList [plain "d"] ]
|
||||
]
|
||||
, testGroup "citations"
|
||||
[ "simple" =:
|
||||
"@item1" =?> para (cite [
|
||||
Citation{ citationId = "item1"
|
||||
, citationPrefix = []
|
||||
, citationSuffix = []
|
||||
, citationMode = AuthorInText
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0
|
||||
}
|
||||
] "@item1")
|
||||
, "key starts with digit" =:
|
||||
"@1657:huyghens" =?> para (cite [
|
||||
Citation{ citationId = "1657:huyghens"
|
||||
, citationPrefix = []
|
||||
, citationSuffix = []
|
||||
, citationMode = AuthorInText
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0
|
||||
}
|
||||
] "@1657:huyghens")
|
||||
]
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue