[citeproc bug] substitute doesn't work correctly for title macro

sample citation style and RDF here:
https://gist.github.com/3670153

Expected output:
“Dictionary Entry.” 2009. <i>Book With Series Title 3rd Edition</i>. Series 3. Location: Test Publisher.

Actual output:
“Dictionary Entry.” 2009. “Dictionary Entry.” <i>Book With Series Title 3rd Edition</i>. Series 3. Location: Test Publisher.

In other words, contrary to specs, the susbtituted macro doesn't get suppressed in the rest of the citation.

(Tested with current stable Zotero, not with branch)
  • edited September 7, 2012
    This is due to some unnecessary logic in the style. The processor should be able to handle it, but it would probably be a good idea to tidy up the style anyway.

    The fault is due to this construct:
    <macro name="contributors">
    <names variable="author">
    <name and="text" name-as-sort-order="first"
    sort-separator=", " delimiter=", "
    delimiter-precedes-last="always"/>
    <label form="verb-short"
    prefix=", " suffix="."
    text-case="lowercase" strip-periods="true"/>
    <substitute>
    <text macro="editor"/>
    <text macro="translator"/>
    <text macro="title"/>
    </substitute>
    </names>
    <text macro="recipient"/>
    </macro>

    The editor and translator macros both look like this:
    <macro name="editor">
    <names variable="editor">
    <name name-as-sort-order="first" and="text"
    sort-separator=", " delimiter=", "
    delimiter-precedes-last="always"/>
    <label form="short" prefix=", " suffix="." strip-periods="true"/>
    </names>
    </macro>

    So the top-level contributors macro is looking for "author", not finding it, and trying the children of the top-level cs:substitute. When it tries the editor macro, it finds a nested full-form cs:names construct. This macro-nested construct is apparently corrupting the substitution list pointer in the processor, allowing it to throw the extra copy of the title.

    The cs:name code in each of the two nested macros uses the same attributes as the master cs:name node in the top-level contributors. As far as I can tell, the two macro calls could be simplified to this, without any change to rendered output:

    <names variable="editor"/>
    <names variable="translator"/>

    I'll take a look at the processor and see if I can get it to behave correctly on these multiply-nested names constructs; but in this case (unless I'm missing something) they don't seem to be necessary.
  • ah yes - I didn't see that, thanks for tracking it down and you're right, that's of course not necessary (if anything, it might be a bad idea).
  • edited September 8, 2012
    The cs:label in contributors should also probably be changed to plain "short".

    In the locales, it looks like verb-short on creators has been used to provide the short form without pluralisation (which seems like an abuse of the semantics, but that's another issue). In the original CMS style construct, verb-short was only applied on "author", where it turns up empty, while plain short (which pluralises) was used in the editor and translator macros.
  • just pushed a general cleaned-up version of the style.
  • The processor is now fixed as well. If similar constructs are lurking in other styles, you won't need to worry about them. I spotted another potential problem while working through the fix -- full-form nested names weren't properly overriding label terms. Both problems are covered by a new test fixture:

    substitute_SuppressOrdinaryVariable
    The updated processor (version 1.0.393) is available in MLZ, and in the processor patch plugin (XPI).
Sign In or Register to comment.