Juris-M / citeproc-js

A JavaScript implementation of the Citation Style Language (CSL) https://citeproc-js.readthedocs.io
Other
297 stars 84 forks source link

"id." isn't capitalized when first word in citation sentence #230

Open dmshapiro opened 9 months ago

dmshapiro commented 9 months ago

I'm not certain I've put this in the right place, but I think I have based on this Zotero forums post. When a citation has position="ibid.", but the "ibid." term has been changed to something else (such as "id." for the JM Indigo Book style), "id." does not correctly change to "Id." when it is the first word in a citation sentence. For example, "The court held that _. X v. Y, 1 U.S. 2 (3456). The court further held that_. Id." would be the correct Indigo/Bluebook formatting, but currently, the last "I" is lowercase. Is there a way for this to be fixed so users don't manually have to go back and fix this when finalizing a document? If I've placed this in the wrong place please let me know.

larsgw commented 9 months ago

It looks like the difference comes from the class of the style. For class="note" (such as in JM Indigo Book Law Review), the terms are capitalized. It looks like the capitalization depends on the context:

[...] the short form Id. (capitalized in a citation sentence after a text sentence) or id. (uncapitalized within a sentence as citation clause) [...] R6.2.2

I am not sure how to give that context to citeproc-js, let alone from Juris-M/Zotero. You could try to change the class of JM Indigo Book, but I do not know what other consequences that would have.

(This is the relevant part of the code, by the way:) https://github.com/Juris-M/citeproc-js/blob/73bc1b44bc7d54d0bfec4e070fd27f5efe024ff9/src/node_text.js#L190-L199

dmshapiro commented 9 months ago

Thanks, I'll try out changing the class of the JM Indigo Book style and report back what the results are given that at least one other person had posted about this issue on the Zotero forums. On Sep 27, 2023, 4:38 AM -0400, Lars Willighagen @.***>, wrote:

It looks like the difference comes from the class of the style. For class="note" (such as in JM Indigo Book Law Review), the terms are capitalized. It looks like the capitalization depends on the context:

[...] the short form Id. (capitalized in a citation sentence after a text sentence) or id. (uncapitalized within a sentence as citation clause) [...] R6.2.2 I am not sure how to give that context to citeproc-js, let alone from Juris-M/Zotero. You could try to change the class of JM Indigo Book, but I do not know what other consequences that would have. (This is the relevant part of the code, by the way:) https://github.com/Juris-M/citeproc-js/blob/73bc1b44bc7d54d0bfec4e070fd27f5efe024ff9/src/node_label.js#L30-L32 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

dmshapiro commented 9 months ago

Can confirm that changing the class is not the way to go. As somewhat expected, that converts all the in-text citations into notes. If anyone has other ideas about how to make this correct, I would appreciate it. To my knowledge there is no way to check within the CSL style file whether the "id." term is the first item in the citation, but if anyone is aware of one, that might solve the problem by just applying text-case="capitalize-first" to it under that condition. On Sep 27, 2023, 10:37 AM -0400, Dylan Shapiro @.***>, wrote:

Thanks, I'll try out changing the class of the JM Indigo Book style and report back what the results are given that at least one other person had posted about this issue on the Zotero forums. On Sep 27, 2023, 4:38 AM -0400, Lars Willighagen @.***>, wrote:

It looks like the difference comes from the class of the style. For class="note" (such as in JM Indigo Book Law Review), the terms are capitalized. It looks like the capitalization depends on the context:

[...] the short form Id. (capitalized in a citation sentence after a text sentence) or id. (uncapitalized within a sentence as citation clause) [...] R6.2.2 I am not sure how to give that context to citeproc-js, let alone from Juris-M/Zotero. You could try to change the class of JM Indigo Book, but I do not know what other consequences that would have. (This is the relevant part of the code, by the way:) https://github.com/Juris-M/citeproc-js/blob/73bc1b44bc7d54d0bfec4e070fd27f5efe024ff9/src/node_label.js#L30-L32 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

fbennett commented 9 months ago

I looked hard at this when building citrproc-js. Unfortunately Zotero provides no hint of the context of a citation embedded in the main text of a word processor. Not great news, I know, but this can't be supported. That's probably the ultimate word, although I would love to be proven wrong: extending Zotero to provide such a hint would be extremely hard, give the complexity of the internal representation of word processor text and the variety of systems that would need to be covered (MS Word, Mac Word, LibreOffice, Google Docs, maybe others in the future).

dmshapiro commented 9 months ago

Thanks for the response. Certainly unfortunate, but ultimately remembering to do a find and replace before finalizing a document still beats doing citations by hand by a wide margin.

Sincerely,

Dylan Shapiro On Sep 27, 2023 at 6:24 PM -0400, Frank Bennett @.***>, wrote:

I looked hard at this when building citrproc-js. Unfortunately Zotero provides no hint of the context of a citation embedded in the main text of a word processor. Not great news, I know, but this can't be supported. That's probably the ultimate word, although I would love to be proven wrong: extending Zotero to provide such a hint would be extremely hard, give the complexity of the internal representation of word processor text and the variety of systems that would need to be covered (MS Word, Mac Word, LibreOffice, Google Docs, maybe others in the future). — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>