Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion about sort_ConditionalMacroDates.txt #31
Comments
This one doesn't make any sense to me either.
Sorts as
as expected (with or without the title being part of the issued-date variable). It'd be great if @fbennett could chime in, but I'd currently call this as an incorrect test and suggest changing it (likely by just removing the title variable from the macro since the test is about dates) |
Ah, I remember this one. Rintze and I discussed the case in 2013, back in the BitBucket days. In the discussion Rintze also questioned the discarding of the non-date text from the macro when generating keys, and noted that doing so is an off-spec invention. As I note in the linked thread, intermixing date and string values in a single key can't be made to produce intuitive sort results. Dates are a bit special: keys for non-date variables are simple strings or numbers that can be derived directly from the variable; but date keys must generate a machine-readable sort key that takes account of the The need to express date keys in a macro can be addressed in one of two ways. One would be to assume that such macros will always contain exactly one date. The other would be to extract a date from an existing macro, and ignore everything else it contains. So that's the reasoning behind it. On a quick check of the repository (based on macro names alone), it looks like a few styles would need to be amended to add and call date-only macros if the former approach is preferred.
|
jgm commentedJun 25, 2020
I'm baffled by this one -- there must be something I'm not understanding.
We have
and the issued-date macro looks like this:
Note the
<text variable="title"/>
which appears before the date. So the output of this macro for the various items should be something likeAnd that should give (for an ascending sort): item-3, item-1, item-2, resulting in:
Instead, the expected result is
Here we get sorting on the date, apparently ignoring the title (and indeed, removing the line with
<text variable="title"/>
makes no difference to citeproc.js).There is no way an ascending sort that looks at titles before dates could give this result. So I'm confused! What am I missing?