CSL test suite — citation item's position

Hi!

Some tests that use CITATION-ITEM specify position field for each item.

For example: position_IfIbidWithLocatorIsTrueThenIbidIsTrue.txt

>>===== CITATION-ITEMS =====>>
[
    [
        {
            "id": "ITEM-1",
            "position": 0
        }
    ],
    [
        {
            "id": "ITEM-1",
            "label": "page",
            "locator": "23",
            "position": 3
        }
    ]
]
<<===== CITATION-ITEMS =====<<

Should the “ibid state” be calculated from locator (the same bibliography entry and locator → ibid; the same entry & different locator → ibid-with-locator; etc.) or from position (where to find appropriate mapping?). And if locator is used to calculate “ibid state”, what is the meaning of position?

Should the “ibid state” be calculated from locator (the same bibliography entry and locator → ibid; the same entry & different locator → ibid-with-locator; etc.) or from position (where to find appropriate mapping?).

The position of each item is determined in a non-trivial way and you can find the details in the descriptions of position condition in the CSL spec. The related code covers a large part of the processCitationCluster() function of citeproc-js (and this function is very long).

And if locator is used to calculate “ibid state”, what is the meaning of position ?

The position field is an internal parameter calculated in the processCitationCluster() process. I guess It appears in the test-suite for easy testing. The meaning of its value is defined in src/load.js#L592-L596.

    POSITION_FIRST: 0,
    POSITION_SUBSEQUENT: 1,
    POSITION_IBID: 2,
    POSITION_IBID_WITH_LOCATOR: 3,
    POSITION_CONTAINER_SUBSEQUENT: 4,