Citation style bug with report number
Since upgrading my Zotero Standalone to 4.0.29.10 I'm having problems with a macro I use on the report number field.
I have a text macro 'issue' which is supposed to add in "no. " (no. with a non-breaking space) when only a numeric value is entered into the report number field.
It used to work fine, but since updating it's behaving strangely.
If I enter 1234 in the report number field I now get '1234' back instead of 'no. 1234'.
If I enter 'no. 1234' I get back 'no. 1234' without the non-breaking space.
If I enter 'Cat. no. 1234' I get back 'Cat. no. 1234'. (So a breaking and non-breaking space. This is a format I need regularly.)
If enter 'Cat. no. 1234.0' I get back 'Cat. 1234.0' (The 'no.' just disappears.)
Any thoughts?
Here's the code:
https://gist.github.com/JoshCraig/46f07e0aa0534bb9a60b7a4310f856b1
I have a text macro 'issue' which is supposed to add in "no. " (no. with a non-breaking space) when only a numeric value is entered into the report number field.
It used to work fine, but since updating it's behaving strangely.
If I enter 1234 in the report number field I now get '1234' back instead of 'no. 1234'.
If I enter 'no. 1234' I get back 'no. 1234' without the non-breaking space.
If I enter 'Cat. no. 1234' I get back 'Cat. no. 1234'. (So a breaking and non-breaking space. This is a format I need regularly.)
If enter 'Cat. no. 1234.0' I get back 'Cat. 1234.0' (The 'no.' just disappears.)
Any thoughts?
Here's the code:
https://gist.github.com/JoshCraig/46f07e0aa0534bb9a60b7a4310f856b1
If you still get bad output with the latest processor, let us know.
Tools>Add ons>Install Add on from file
But I don't see any change to my references (even after refreshing and swapping back and forward between citation styles).
For the record, the subsequent-author-substitute issue I was just posting about (https://forums.zotero.org/discussion/62292/subsequent-author-substitute-not-working-for-single-field-authors#latest) also doesn't seem to be fixed with the Propachi plugin.
It is possible that the Propachi plugin does not take effect correctly in Standalone. If you have Firefox installed, you could test to see if the Propachi plugin fixes your references in Zotero for Firefox (after stopping Standalone). If it does the trick, you could use that for the present, while waiting for a fresh official release of Standalone.
http://aurimasv.github.io/z2csl/typeMap.xml#map-report
works with that corrected (and the other call of the number variable, which is why this is getting rendered at all, removed)
Sorry for my ignorance, but which bit do I need to change?
I've completely deleted the macro and just tried using
and in the bibliography.
In both cases, if I have 'Cat. no. 1234.0' in the Report Number field it returns:
'Cat. 1234.0'
Is this what I should expect to see??
text variable="number"
and
number variable="number"
Also might be worth noting that 'no.' doesn't get suppressed if it's sentence case 'No.'
Cat. no. 12345.0 deletes 'no.'
Cat. no. 12345 keeps 'no.'
no. 12345 gets rid of 'no.'
no. 12345.0 gets rid of 'no.'
Most of the weirdness here is caused by an internal list of short-codes in the processor that includes "number," on the assumption that the CSL locale will follow the CSL schema, which does specify a "number" term.
Unfortunately, the CSL locales do not provide any value for a "number" term.
So when the processor attempts to access the missing term, it turns up empty, and you get no label at all. For an immediate fix, define the "number" term in the style's own locale. That should not cause a validation error, since the term is in the grammar specification for CSL 1.0.1.
When the label is included or not depending on an "is-numeric" test, things should then work normally, with one exception. The input "Cat. no. 1234.0" evaluates as "non-numeric" (and so omits the label, in the conditional code I have tested with here). There is a bug that causes it to throw out the "no." manually entered in the field: that is not right, and I will look into it as soon as I get a chance. Everything else seems to be in order.
Thanks to the ambition of my bad-boy extensions to numeric variable processing, this was a little tricky; but I think the fixes have put things back in order. There were two problems:
- A mid-field short-code label before a non-numeric element (as in "Cat. no. 1234.0") was being swallowed.
- The "no." short-code inside a field is mapped to the "issue" variable, and that promised to become a source of further confusion.
The fixes prevent loss of short-code labels that come before or after a non-numeric element by treating the short-code and the elements before and after it as literal text.When rendering labels on numeric elements for the "number" variable only, the processor will use a "number" term if available, falling back otherwise to the "issue" term. (No style defines a "number" term at present, but if a need arises to define the two terms separately, things should work as expected.)
Apologies for the inconvenience, and thanks to everyone for pinning this issue down.