I am having a test failure where I do not understand the logic of the correct result. (In fact, I am having several test failures which I think are symptomatic of the same lack of understanding on my part: but one can take one test as a core case.) The test is sort_BibliographyCitationNumberDescending.txt
The basic scheme is this: we have eight items (item-1 to item-8), which are cited in the order 1-8. The citation layout does not print the citation number, and there is no pre-sort: so each acquires an implicit citation number from 1 (for item-1) to 8 (for item-8), but none of those numbers is printed during the citation phase (or implicit citation phase).
The bibliography section is sorted by citation-number descending, so we expect item-8 to be output first, and then successively items 7, 6 (etc). I’ve pasted the expected and actual output below: note that the book titles do not correspond to the item numbers. The order of titles is (correctly) “001” (= item-1), “003”, “004”, “006”, “002”, “005”, “007” and “008” (= item-8).
My sort order is the same as that in the test. But the bibliography also prints the citation number, with affixes “[” and “]”. My processor is printing the citation number as it was used in the sort, so item-8 gets citation number “[8]” etc. But the reference test, although it sorts item-8 with citation number 8, is printing that citation number as “[1]”. Why?
This seems to assume that a citation number (as used for sorting) and the printed form of the citation number should be different, and that the printed from should only be “baked in” when it is first printed. I’m not sure I follow the logic of this in terms of its use-case, and since tracking (separately) “printed-citation-number” and “actual-citation-number” would be tiresome, and potentially ambiguous. I wonder if it is necessary, in practical terms?
I am probably missing something obvious, but I’m afraid I’m stuck.
tests/sort_BibliographyCitationNumberDescending.txt FAILED
-------- EXPECTED --------
<div class="csl-bib-body">
<div class="csl-entry">[1] Book 008</div>
<div class="csl-entry">[2] Book 007</div>
<div class="csl-entry">[3] Book 005</div>
<div class="csl-entry">[4] Book 002</div>
<div class="csl-entry">[5] Book 006</div>
<div class="csl-entry">[6] Book 004</div>
<div class="csl-entry">[7] Book 003</div>
<div class="csl-entry">[8] Book 001</div>
</div>
----------- GOT -----------
<div class="csl-bib-body">
<div class="csl-entry">[8] Book 008</div>
<div class="csl-entry">[7] Book 007</div>
<div class="csl-entry">[6] Book 005</div>
<div class="csl-entry">[5] Book 002</div>
<div class="csl-entry">[4] Book 006</div>
<div class="csl-entry">[3] Book 004</div>
<div class="csl-entry">[2] Book 003</div>
<div class="csl-entry">[1] Book 001</div>
</div>
Error at byte 54: 1:8