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
  • For the record, I have passed it through the CSL Style and Locale Validator and it generators no errors.
  • I'm getting different output:
    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> )
  • It should work a bit better if you insert a closing </choose> tag at line 117, and add an opening <choose&gt tag at line 95 (the style currently isn't valid CSL, which is probably why the condition fails).
  • edited July 10, 2016
    (returning to the thread in another guise)

    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.
  • Yes, sorry about that -- I should have checked validation. With validation fixed and the extraneous spaces around = in
    <names variable = "author" prefix=" (" suffix=")"> removed, this works correctly for me.
  • edited July 12, 2016
    Thanks for your help, but I'm afraid I still can't quite get the intended output.

    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...
  • edited July 12, 2016
    My apologies, I hadn't fixed the extraneous spaces around = .

    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!!
  • Glad to hear it's working!

    @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?
  • No strong feelings around this, but generally speaking, if it's not valid it shouldn't pass validation -- and we may not be able to make that happen, I believe?
  • It's not a validation issue, but the processor. My (new-ish) parser doesn't like spaces around an = sign it the XML, but technically that's okay, I think k. I could try to allow that in the processor, but I'm not sure it's really needed.
  • sorry, I meant "if it doesn't work, it shouldn't pass validation".
    I agree that it's not really needed, but I'm a bit worried about having mysterious problems with styles that do validate.
  • edited July 12, 2016
    I'm pretty sure https://github.com/citation-style-language/utilities/blob/master/csl-reindenting-and-info-reordering.py will strip any extraneous whitespace, since it writes out parsed styles and doesn't update styles in-place. So (eventually) this is taken care of for repository styles.

    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).
  • (http://formatter.citationstyles.org/ also strips those spaces)
Sign In or Register to comment.