Unexpected behavior with article-locator

In the following fixture, the <label> is expected to render art. and <else-if locator="article-locator"> should test true for the cite item with "label": "article-locator". But the current citeproc-js gives:

      + expected - actual

       p. 42 is page
      -42 is other
      +art. 42 is article-locator
       art. 43 is other

The locator article (without -locator) seems to work but the validator complains “Bad value ‘article’ for attribute ‘locator’ on element ‘else-if’” and <else-if locator="article"> tests false.

>>===== MODE =====>>
citation
<<===== MODE =====<<


>>===== RESULT =====>>
p. 42 is page
art. 42 is article-locator
art. 43 is other
<<===== RESULT =====<<


>>===== CITATION-ITEMS =====>>
[
    [
        {
            "id": "ITEM-1",
            "locator": "42",
            "label": "page"
        }
    ],
    [
        {
            "id": "ITEM-1",
            "locator": "42",
            "label": "article-locator"
        }
    ],
    [
        {
            "id": "ITEM-1",
            "locator": "43",
            "label": "article"
        }
    ]
]
<<===== CITATION-ITEMS =====<<


>>===== CSL =====>>
<style
      xmlns="http://purl.org/net/xbiblio/csl"
      class="note"
      version="1.0">
  <info>
    <id />
    <title />
    <updated>2023-07-29T19:35:54+08:00</updated>
  </info>
  <citation>
    <layout>
      <group delimiter=" ">
        <label variable="locator" form="short"/>
        <text variable="locator"/>
        <choose>
          <if locator="page">
            <text value="is page"/>
          </if>
          <else-if locator="article-locator">
            <text value="is article-locator"/>
          </else-if>
          <else-if locator="article">
            <text value="is article"/>
          </else-if>
          <else>
            <text value="is other"/>
          </else>
        </choose>
      </group>
    </layout>
  </citation>
</style>
<<===== CSL =====<<


>>===== INPUT =====>>
[
    {
        "id": "ITEM-1",
        "type": "legislation"
    }
]
<<===== INPUT =====<<


>>===== VERSION =====>>
1.0
<<===== VERSION =====<<

did article-locator just not make it into citeproc-js? There was some back-and-forth about naming, IIRC. If so, that’d seem to be a pretty easy fix.

I try to make a patch in zepinglee/citeproc-js@d022a4e. The variables in three related lines of JavaScript code are renamed to “article-locator”. There are also a bunch of test fixtures involving this locator and they are renamed as well in the commit. Luckily the patch passes the CI test (https://github.com/zepinglee/citeproc-js/actions/runs/5700789273) but I’m not confident enough that it has no side effects.

I also test the style in Zotero and it doesn’t work as well. We may need to check the exported locator label in CitationItem if this patch is accepted.

Did this get resolved? I think I may have run into this issue when attempting to write a CSL style, where I cannot seem to isolate the article-locator with choose.

The code in question is:

        <choose>
          <if locator="page">
           <group delimiter="&#160;">
              <label variable="locator" form="short"/>
              <text variable="locator"/>
            </group> 
          </if>
          <else-if locator="paragraph">
            <group delimiter=" ">
              <label variable="locator" form="long"/>
              <text variable="locator"/>
            </group>
          </else-if>
          <else-if locator="article-locator">
            <group delimiter=" ">
              <label variable="locator" form="long"/>
              <text variable="locator"/>
            </group>
          </else-if>
          <else>
            <group delimiter=" ">
              <label variable="locator" form="short"/>
              <text variable="locator"/>
            </group>
          </else>
        </choose>

With this code, the locator label for paragraph (“paragraph”) is printed in long form, as expected. However, the locator label for article (“article-locator”) is printed in short form. This despite the two else-if conditions being identical (apart form the locator term).

(I’m viewing the output in the Zotero Style Editor, which I reckon uses citeproc-js.)

This is just fixed in juris-m/citeproc-js#263.

Fantastic, thanks! How often does Zotero pull in updates from citeproc-js? Every minor version?

To answer my own question: this does not happen automatically for each minor Zotero version (8.0.1 did not include the fix), but I see that there is now an issue in the Zotero repo where one can track progress: Pull in latest citeproc-js fixes · Issue #5767 · zotero/zotero · GitHub