-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support no-date citations #70
Comments
This is actually an interesting case: the relevant part of the style is this (in the else branch of a conditional checking whether there is a filled in <else>
<group>
<text term="no date" form="short"/>
<text variable="year-suffix" prefix="-"/>
</group>
</else> according to the standard,
on my reading this means that the standard-compliant rendering is to suppress the term when |
I believe @bwiernik has coded a lot of the APA style, so perhaps he can weigh. But at first glance, I agree this doesn't look like a citeproc bug (though does seem like a style bug). Still, surprising if a bug in the style, given how widely it's used. |
Hmm, it may be that both pandoc and citeproc-js diverge from the spec on this point or treat year-suffix specially, as the style works correctly with both of them. Let me look into it. There doesn't at first glance look like a need for a group here. |
What's interesting is the group is not there in the only other place "no date" shows up in the style. |
I'm also looking at the the other, groupless "no date" occurrence and |
Unnecessary and removing ensures good performance across citeprocs andras-simonyi/citeproc-el#70 (comment)
I opened a PR for the style to remove that group |
meanwhile I've found this comment in the if (variable === "year-suffix") {
// year-suffix always signals that it produces output,
// even when it doesn't. This permits it to be used with
// the "no date" term inside a group used exclusively
// to control formatting. this kind of settles the issue for me. OTOH, maybe this special status of |
I'd probably need to think about it more, but doesn't that sound a bit hackish? Or at least I'm not clear on it; what does that last clause mean? I wonder how citeproc-rs (which is basically a clean rewrite in rust) handles this ... |
Well, let's ask @cormacrelf |
But I agree that's hackish. Could we convert no date into some sort of substitute for a missing year? I mean in a future release. |
It looks like that's what cormac is doing. Is there something in our spec that is ambiguous, that needs to be changed here? Or is this just a citeproc-js thing? My hunch is the latter; that it's an internal detail. |
AFAICS the problem is that the |
Ah, right. In effect, the value for a nil date is not nil. Citations can be such a PITA. |
I think the easiest approach would be to make a "no-date" variable which is empty if issued is present and renders the no-date term otherwise That would solve the need to special treatment of year-suffix entirely and can be fixed in existing styles by a batch change |
As a temporary solution I've merged a PR hopefully fixing this particular issue by not reporting an empty variable if the variable happens to be the |
Bruce has the right tack on what citeproc-rs is doing (also note UnresolvedMissing comes from mixing with Unresolved, which according to a grep on the codebase is not used for anything else other than For any implementation, it is important to recognise that the rendering of a cite changes as it goes through disambiguation, and that implicit conditionals are a part of the rendering process. Variables that were initially found to be empty may no longer be, and so implicit conditionals that were once implicitly suppressed may no longer be. If your model of the renderer is a completely pure function of As has been suggested, the most helpful addition you could make to the spec would be that the implicit conditional part include a mention of year-suffix, as the delayed resolution of its presence or absence is the only reason this happens (in current CSL at least). Something like
|
@bwiernik The
The problem statement is incorrect:
It has a genuinely special rendering status, with no qualifications on that. Any interaction with missing
It is just that this device is much rarer, and is not really tested AFAIK. Nevertheless, I believe a variable rendered inside such a conditional should technically be able to wake a ghost group from the dead. |
If citeproc writers are happy to treat year-suffix as always being non-empty, even if it renders nothing, that's fine by me. |
I disagree. You need it to work with implicit conditionals. Treating it as always non-empty means that the example from above with the grouped term + year-suffix would need an explicit conditional, which is in my view a breaking change to the implicit conditional behaviour promised by the spec. It looks like it would be a very involved review of the styles in the repo to rectify. For example here it would result in empty renders (should be CSL ERROR etc) showing up as
<group>
<text term="circa" /> <!-- please don't render me unnecessarily! -->
<text macro="date-year" /> <!-- renders one of any number of date variables, or some other term -->
<text variable="year-suffix" /> <!-- can't feasibly test all those date variables to guard this -->
</group> That's almost what's going on here |
Ah, it goes even further: year-suffix is subject to multiple-use suppression. You cannot reliably know, even by testing This would mix especially poorly with e.g. APA-style date macros called called multiple times due to If anything I think |
Cormac I think we are thinking about the issue on weirdly different levels, so let's zoom out. What is the issue we are trying to resolve? I thought the problem was the conflict of the general "groups are suppressed if all variables are empty" logic with the expect related to I offered 2 solutions to this unique exception. Either we introduce a new date variable that can avoid the group suppression logic (which is necessary and sufficient to resolve the issue at hand), or we short circuit the group-related suppression logic for the unique case that is There seems to be some broader issue about variables we are disagreeing on. Can you elaborate about what your concern is? |
I don't fully understand the Haskell code, but here seems to be where the new Haskell library handles it. |
Has anyone actually checked pandoc's behaviour? I don't understand how |
Ok, it does work correctly. |
Unnecessary and removing ensures good performance across citeprocs andras-simonyi/citeproc-el#70 (comment)
It works beautifully. Thank you! |
Ok, a couple of clarifications:
For a thorny example of why year-suffix always acting non-empty (despite mostly being literally empty) is worse: <group>
<text value="prefix-" />
<date variable="issued" />
<text variable="year-suffix" />
</group> You don't want a lone Whereas with |
I think that's pretty much the reasoning behind my suggestion above to convert "no date" into some sort of a substitute for a missing year. I was thinking about something like this: <date variable="issued" >
<substitute term="no date"/>
</date> Here, the term would act as a variable. So, @cormacrelf's example would look like this: <group>
<text value="prefix-" />
<date variable="issued" >
<substitute term="no date"/>
</date>
<text variable="year-suffix" />
</group> |
Is that the problem though. Isn't suppressing terms when an accompanying variable is not present is one of the core reasons for this feature? Perhaps my mental model of when terms are used inside groups like this is wrong. What are some other examples where a term should be suppressed or not suppressed when paired with a variable in group? I'm wondering if this is specific to the no date/year-suffix context. |
Read it again, I wasn't referring to the general behaviour that terms have (and should have), I was talking about how it applies to There might be other terms like this, and a cursory look through the list gives two others: <macro name="date">
<choose><if variable="issued">
<date variable="issued" ... />
</if>
<else>
<text term="no date" />
</else></choose>
</macro>
...
<group>
<text value="first published " />
<text macro="date" />
</group> You would really expect this to work as if a variable had been rendered, even in the case of There is another solution using the following, but as I just outlined, it requires thinking your way around the natural meaning of no date and digging into the CSL spec for an author to accomplish. <!-- no variables attempted inside the group, so it is never suppressed! -->
<group>
<text term="no date" />
</group>
<text variable="year-suffix" /> The examples you were looking for: <group> <!-- absent any variable attempts inside (and through macros/conditionals), group is not suppressed -->
<text value="verbatim" />
<text term="reference" /> <!-- terms and values are treated the same way -->
</group>
<group>
<text value="verbatim" />
<text variable="MISSING" />
<text variable="AS MANY MISSING AS YOU LIKE" />
<text variable="PRESENT" /> <!-- satisfies the group condition,
it attempted many but one succeeded;
the group is not suppressed -->
</group>
<group>
<text value="verbatim" />
<text variable="MISSING" /> <!-- causes group to be suppressed as a whole -->
</group> |
I have been citing no-date items for a while now, and it works. Can I close this issue? |
Yes, I think so -- thanks is advance! |
In APA Style, citing sources with no
date
BibTeX field should render as$AUTHOR (n.d.)
instead of$AUTHOR
.Tested with Pandoc and CSL: https://github.com/citation-style-language/styles/blob/master/apa.csl
The text was updated successfully, but these errors were encountered: