CSL Discourse

citeproc-js: setting variables via the CSL "note" field


#1

Dear all,

As many on the list will know, citeproc-js has long contained a hack to
permit the user to set CSL variables that cannot be entered via a calling
application’s UI due to schema constraints or the like. The syntax for this
is an ugly think that has attracted its share of rotten tomatoes. For the
blissfully uninitiated, this “braced-entry” syntax looks like this:

{:original-date: 2001-04-15} {:version: 2.3}

There have been calls to replace this with a “line-entry” syntax that is a
bit more familiar and easier to document and explain, viz:

original-date: 2001-04-15
version: 2.3

The first syntax was ill-advised (sorry about that), but it’s been around
for quite awhile, and there is quite a bit of data about that makes use of
it (sorry about that too). The latter syntax should be preferred to the
former, but thanks to legacy data, we need a parser that recognizes both in
order to introduce it. With a bit of iterative revision (and debugging of
things in the old code that were plain broken), I’ve come up with such a
chimera. Implementations have been included in very recent processor
releases (since tag 1.1.132). A final version will be coming up in a tag
1.1.136, after a round of feedback. You can watch for this exciting
development in the repo release listing:

https://github.com/Juris-M/citeproc-js/releases

This will change the default behaviour of the processor, and I don’t want
anyone to be surprised by caught off-guard after a deployment. To that end,
the processor manual has a full description of the “cheater syntax,” with
instructions on how to disable it if it is not desired.

http://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html#cheater-syntax-for-odd-fields

If you have questions, or if you would like to see changes in the behaviour
or in the description in the manual, don’t hesitate to post a reply to this
mail. I’ll wait a day or so for comments before unleashing the final code.

Frank