Citation-number sort test mystery

I am looking at sort_BibliographyCitationNumberDescendingViaMacro.txt

It is pretty simple. It has eight basic input references and this sorting configuration:

<sort>
   <key macro="citation-number" sort="ascending"/>
   <key macro="citation-number" sort="descending"/>
</sort>
<macro name="citation-number">
   <text variable="citation-number"/>
</macro>

I am confused, however, by the expected output of

<layout>
   <text variable="citation-number" prefix="[" suffix="] "/>
   <text variable="title" />
</layout>

as

[8] Book One
[7] Book Three
[6] Book Four
[5] Book Six
[4] Book Two
[3] Book Five
[2] Book Seven
[1] Book Eight

The titles are in the given input order but the citation numbers are in reverse order.

However, when I read the spec, a second <sort><key/></sort> is only used for "items sharing the first sort key value,” in this case, the same citation-number. So the sort=“descending” variant in this test shouldn’t apply.

There could be a feedback loop I’m missing since it seems this is sorting by the same value it’s altering, that is, the position of the reference in the bibliography. But I still don’t see a scenario where references would have the same citation-number.

I seem to recall having the same discussion when John MacFarlane re-wrote citeproc for pandoc. (He also has a list of tests his citeproc purposefully doesn’t pass that may be useful for you). @bwiernik @Bruce_D_Arcus1 do either of you recall where those discussions are? Are they on the github for the specs?

I think most of them happened on the test suite repo.

1 Like

Yeah, in general, the issue tracker on the test suite repo is the place to go, including for new questions on the details there.

Thanks guys. I’ll check there for questions like this instead of spamming the forum :slightly_smiling_face: