Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Error with citation keys containing :/ or // #166

Closed
njbart opened this issue Sep 12, 2015 · 3 comments
Closed

Error with citation keys containing :/ or // #166

njbart opened this issue Sep 12, 2015 · 3 comments

Comments

@njbart
Copy link
Contributor

njbart commented Sep 12, 2015

pandoc-citeproc does not seem to like citation keys/ids generated by zotero. All characters are valid, according to http://pandoc.org/README.html#citations, but the :/ or // combinations appear to be showstoppers.
(http:zotero.org/users/1234567/items/A1B2C3D4 or http/zotero.org/users/1234567/items/A1B2C3D4 seem ok, for instance, but not http:/zotero.org/users/1234567/items/A1B2C3D4 or http//zotero.org/users/1234567/items/A1B2C3D4.)

Example:

cat > test.json << EOT
[
    {
        "id": "http://zotero.org/users/1234567/items/A1B2C3D4",
        "type": "book",
        "title": "Test",
        "author": [
            {
                "family": "Author",
                "given": "Al"
            }
        ],
        "issued": { "date-parts": [[ "2014" ]] }
    }
]
EOT

pandoc  -F pandoc-citeproc --biblio test.json -t plain << EOT

@http://zotero.org/users/1234567/items/A1B2C3D4

# References

EOT
@jgm
Copy link
Owner

jgm commented Sep 18, 2015

What the manual says:

The citation key must begin with a letter, digit, or _, and may contain alphanumerics, _, and internal punctuation characters (:.#$%&-+?<>~/).

The question is, what counts as an "internal" punctuation character? This is a tricky question to answer (at least for author-in-text citations). For example, one might write

As @smith2005---the originator of this phrase---says, ...

Is the citation key @smith2005 or @smith2005---the? Pandoc decides that something is internal punctuation if it is followed by something other than punctuation or space. That's why your URL ids aren't working.

This is a tricky problem, advice welcome. One option would be to build in some special-case heuristics, e.g. allowing ://, but this makes the rule more complicated.

@njbart
Copy link
Contributor Author

njbart commented Sep 19, 2015

I’m not sure. Adding a single exception for :// would sure be nice for the Zotero case.
Apart from that, just a few unordered thoughts:

  • Valid bibtex/biblatex keys may contain sequences of (valid) punctuation characters of any length. This might be an argument for allowing them in pandoc, too. OTOH, no one seems to have reported such problems with their bibtex/biblatex keys before.
  • Same for DOIs, which users could potentially want to use as citekeys.
  • We could change the syntax, so author-in-text citations would have to use, e.g., As [+@smith2005]---the originator of this phrase---says, ... (not backward compatible, also I suggested to use [+@smith2005] for \fullcitebefore).
  • <!----> could be used to indicate where an ambiguous citekey ends.

@jgm
Copy link
Owner

jgm commented Sep 26, 2015

Perhaps allowing any sequence of internal punctuation characters, with the exception of hyphens and dashes (which are used without following spaces), would be safe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants