Prefix and suffix not working in citation style
I recently upgraded my Zotero only to find that my custom citation style no longer generates bibliographies as intended.
In lieu of a field to enter abbreviations for institutional authors, I have been using the translator field to enter abbreviations to create output like this:
Individual citation:
('translator' 'year')
e.g. (ABS 2010)
Bibliography:
'translator' ('author') 'year', etc...
e.g. ABS (Australian Bureau of Statistics) 2010, etc...
But since I have upgraded, the prefix and suffix fields I use to create the parenthesis around the 'author' part in the bibliography no longer work. Instead the result looks like:
ABSAustralian Bureau of Statistics 2010, etc...
Is there any way I can fix this?
Here is my code. The relevant line is 103.
https://gist.github.com/anonymous/74278c42806e494b07f6cf6ba85c4070
In lieu of a field to enter abbreviations for institutional authors, I have been using the translator field to enter abbreviations to create output like this:
Individual citation:
('translator' 'year')
e.g. (ABS 2010)
Bibliography:
'translator' ('author') 'year', etc...
e.g. ABS (Australian Bureau of Statistics) 2010, etc...
But since I have upgraded, the prefix and suffix fields I use to create the parenthesis around the 'author' part in the bibliography no longer work. Instead the result looks like:
ABSAustralian Bureau of Statistics 2010, etc...
Is there any way I can fix this?
Here is my code. The relevant line is 103.
https://gist.github.com/anonymous/74278c42806e494b07f6cf6ba85c4070
I get
ABS (Australian Bureau of Statistics)Australian Bureau of Statistics
in other words, I get the author twice. The reason for that is that the else condition in line 106 doesn't work correctly (and I do think that's a bug).
FWIW, for me this work correctly if I change l. 106 yo
<else-if variable="translator" match="none">
(and accordingly line 116 to </else-if> )
Another small issue is that the declared default locale, "en-AU" is not a valid known locale, so it will just fall back to en-US (on systems that are robust to the non-existent locale), or crash (on systems that are not).
To keep things tidy, you could define your style-specific terms on en-US (or en-GB if that is closer to requirements), and set that as the default locale as well.
<names variable = "author" prefix=" (" suffix=")"> removed, this works correctly for me.
I've changed from en-AU to en-GB and added the < choose > and < /choose > tags at the start and the end of the macro "author".
https://gist.github.com/JoshCraig/cb6f97324eab681b3a0c0a8e8e603ccf
In Zotero Standalone v4.0.20 the bibliography is generated correctly as:
ABS (Australian Bureau of Statistics) 2010, etc..
But in Zotero Standalone v4.0.29.10 I still just get:
ABS 2010, etc...
That seems to be the root of the problem. In v4.0.20 it tolerated the spaces, not so in v4.0.29.10.
As always, thanks very much for your help!!
@adamsmith, @Dan Stillman: I didn't realize that spaces around = were permitted in XML. How important is it to loosen the internal citeproc-js parser to permit them?
I agree that it's not really needed, but I'm a bit worried about having mysterious problems with styles that do validate.
That said, it would be good if all valid XML is parsed correctly by citeproc-js. I'm not entirely clear on the whitespace rules, though (https://www.w3.org/TR/REC-xml/ is rather hard to digest, but I did find http://usingxml.com/Basics/XmlSpace).