citation-style-language / test-suite

11 stars 13 forks source link

Why does explicit `cite-group-delimiter` override `year-suffix-delimiter`? #50

Open zepinglee opened 2 years ago

zepinglee commented 2 years ago

In name_CiteGroupDelimiterWithYearSuffixCollapse.txt, the cite-group-delimiter is explicitly set ", " and the year-suffix-delimiter is by default the delimiter of citation > layout (i.e., "; ") according to the spec.

https://github.com/citation-style-language/test-suite/blob/0c366b60b35bd20cdc9d1a1e3b9c04756645868f/processor-tests/humans/name_CiteGroupDelimiterWithYearSuffixCollapse.txt#L37-L38

In the result, only cite-group-delimiter (", ") is outputed.

https://github.com/citation-style-language/test-suite/blob/0c366b60b35bd20cdc9d1a1e3b9c04756645868f/processor-tests/humans/name_CiteGroupDelimiterWithYearSuffixCollapse.txt#L5-L7

I also check other cases and the results of citeproc-js f56f8c95 are as follow. It seems that cite-group-delimiter is used as the delimiter of year suffixes if it's explicitly set. I can't find relevant description in the spec.

cite-group-delimiter year-suffix-delimiter Result
", " Not set (Aalto 2015a, b)
", " "!" (Aalto 2015a, b)
Not set "!" (Aalto 2015a!b)
Not set Not set (Aalto 2015a; b)
adam3smith commented 2 years ago

If I'm understanding the question correctly, it's a question about the hierarchy of delimiter rules for citations, which I agree are not covered by the specs. In other words, it's row 2 of the table above that's in question. Is that correct?

The current test suite and citeproc-js behavior seems to be that cite-group-delimiter overrules year-suffix-delimiter. I agree that's not ideal, since year-suffix-delimiter is a subset of cite-group-delimiter and generally we have more specific rules taking precedence over more general rules. In terms of possible outputs, for example, if I want to have (Doe 2008; Smith 2012) -- delimiter="; " (Doe 2008, 2010) -- cite-group-delimiter=", " (Doe 2008a,b) -- year-suffix-delimiter="," that's not possible with current behavior. On the other hand, I don't see any output that's not possible with year-suffix-delimiter taking precedence.

zepinglee commented 2 years ago

If I'm understanding the question correctly, it's a question about the hierarchy of delimiter rules for citations, which I agree are not covered by the specs. In other words, it's row 2 of the table above that's in question. Is that correct?

I've not fully understood row 1. The current spec says:

year-suffix-delimiter Specifies the delimiter for year-suffixes. Defaults to the delimiter set on cs:layout in cs:citation.

The current behavior is that year-suffix-delimiter inherits the value of cite-group-delimiter unless explicitly set.

zepinglee commented 2 years ago

I just find https://github.com/citation-style-language/test-suite/issues/36#issuecomment-667126525 and it's clear now.

bwiernik commented 2 years ago

Could you elaborate on what's clear? I'm not sure I understand. I agree with @adam3smith that year-suffix-delimiter should take precedence if both are set. Is that not the case?

It makes sense to me that if cite-group-delimiter is set but year-suffix-delimiter is not set, that year-suffix-delimiter should default to cite-group-delimiter rather than the overall layout delimiter. If that's the current behavior that you're seeing, we should fix that in the spec.

zepinglee commented 2 years ago

Could you elaborate on what's clear? I'm not sure I understand. I agree with @adam3smith that year-suffix-delimiter should take precedence if both are set. Is that not the case?

It makes sense to me that if cite-group-delimiter is set but year-suffix-delimiter is not set, that year-suffix-delimiter should default to cite-group-delimiter rather than the overall layout delimiter. If that's the current behavior that you're seeing, we should fix that in the spec.

Sorry, I was messed up with a bunch of test cases. I agree that year-suffix-delimiter should take precedence over cite-group-delimiter.

Besides the description of cite-group-delimiter's default value may be mistaken.

https://docs.citationstyles.org/en/stable/specification.html#cite-grouping

cite-group-delimiter Activates cite grouping and specifies the delimiter for cites within a cite group. Defaults to “, “.

zepinglee commented 2 years ago

I check several case in test-suite and confirm the default values of both parameter in the current citeproc-js implementation are as described in spec: cite-group-delimiter defaults to ", " (sort_GroupedByAuthorstring.txt) and year-suffix-delimiter defaults to the delimiter in citation > layout (magic_ImplicitYearSuffixDelimiter.txt). The current behavior of year suffixes' delimiter can be summarized: if cite-group-delimiter is explicitly set, it takes precedence over year-suffix-delimiter; Otherwise year-suffix-delimiter or its default value is used. IMHO it's a strange behavior.

bwiernik commented 2 years ago

Yeah, that doesn't seem correct.