Skip to content
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

year-suffix-delimiter is not actually used #215

Open
Circeus opened this issue Oct 16, 2022 · 7 comments
Open

year-suffix-delimiter is not actually used #215

Circeus opened this issue Oct 16, 2022 · 7 comments

Comments

@Circeus
Copy link

Circeus commented Oct 16, 2022

I've been futzing around trying desperately to set a year-suffix-delimiter in my style in the online editor. I never managed to, but I figured out why: what actually seems to happen is that when a collapse= attribute it set, cite-group-delimiter is used instead of year-suffix-delimiter, which causes the default to be ", " (that of cite-group-delimiter) instead of the delimiter set in layout (which is the default for year-suffix-delimiter). More importantly, this default will override any explicit values given to year-suffix-delimiter,

@bwiernik
Copy link
Contributor

You you give a specific example of items showing this problem, a minimal style with the faulty combination of options, the current output, and the expected output?

@Circeus
Copy link
Author

Circeus commented Oct 16, 2022

This is the reference set I've been using to test this:

[
	{
		"id": "http://zotero.org/users/10305383/items/5739YA6H",
		"type": "book",
		"event-place": "London",
		"number-of-pages": "v-xiv, 957",
		"publisher": "The Zoological Society",
		"publisher-place": "London",
		"title": "Nomenclator Zoologicus. A list of the names of genera and subgenera in zoology from the tenth edition of Linnaeus 1758 to the end of 1935.",
		"volume": "Vol. I. A–C.",
		"author": [
			{
				"family": "Neave",
				"given": "S.A."
			}
		],
		"issued": {
			"date-parts": [
				[
					"1939"
				]
			]
		}
	},
	{
		"id": "http://zotero.org/users/10305383/items/YZ7KLMAD",
		"type": "book",
		"event-place": "London",
		"number-of-pages": "1025",
		"publisher": "The Zoological Society",
		"publisher-place": "London",
		"title": "Nomenclator Zoologicus. A list of the names of genera and subgenera in zoology from the tenth edition of Linnaeus 1758 to the end of 1935.",
		"volume": "Vol. II. D–L.",
		"author": [
			{
				"family": "Neave",
				"given": "S.A."
			}
		],
		"issued": {
			"date-parts": [
				[
					"1939"
				]
			]
		}
	},
	{
		"id": "http://zotero.org/users/10305383/items/GLTR6E6I",
		"type": "book",
		"event-place": "London",
		"number-of-pages": "1065",
		"publisher": "The Zoological Society",
		"publisher-place": "London",
		"title": "Nomenclator Zoologicus. A list of the names of genera and subgenera in zoology from the tenth edition of Linnaeus 1758 to the end of 1935.",
		"volume": "Vol. III. M–P.",
		"author": [
			{
				"family": "Neave",
				"given": "S.A."
			}
		],
		"issued": {
			"date-parts": [
				[
					"1940"
				]
			]
		}
	},
	{
		"id": "http://zotero.org/users/10305383/items/8NAW7FT7",
		"type": "book",
		"event-place": "London",
		"number-of-pages": "758",
		"publisher": "The Zoological Society",
		"publisher-place": "London",
		"title": "Nomenclator Zoologicus. A list of the names of genera and subgenera in zoology from the tenth edition of Linnaeus 1758 to the end of 1935.",
		"volume": "Vol. IV. Q–Z",
		"author": [
			{
				"family": "Neave",
				"given": "S.A."
			}
		],
		"issued": {
			"date-parts": [
				[
					"1940"
				]
			]
		}
	}
]

A CSL code is [dashes for exmphasis]

<citation disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter="--">
    <sort>
      <key variable="author"/>
      <key variable="issued"/>
    </sort>
    <layout delimiter="; " prefix="(" suffix=")">
      <group delimiter=":">
        <group delimiter=" ">
          <text macro="author-short" suffix=","/>
          <text macro="issued-year"/>
        </group>
        <text variable="locator"/>
      </group>
    </layout>
  </citation>

With this code, I'd expect (Neave, 1939a--b--1940a--b). What I actually get is (Neave, 1939a, b, 1940a, b).

With

<citation disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter=", " cite-group-delimiter="--">

then I get (Neave, 1939a--b--1940a--b). Which is not supposed to happen at least if I read the spec correctly? The spec clearly implies that cite-group-delimiter and collapse are not supposed to be used together ("Cite grouping can be activated by setting the cite-group-delimiter attribute or the collapse attributes"), but also does not state a behavior if both are defined.

And finally with <citation disambiguate-add-year-suffix="true" collapse="year-suffix"

I should get (Neave, 1939a; b; 1940a; b) according to the spec's own explicit example because the semicolon is set in "layout". What I actually get is (Neave, 1939a, b, 1940a, b), i.e. the default for cite-group-delimiter. At no point in these tests has year-suffix-delimiter ever been applies, or am I fundamentally misunderstanding something?

As a side note, I cannot tell from reading the spec whether you're supposed to be able to specify a distinct delimiter to appear between the collapsed"1939b" and "1940a".

@zepinglee
Copy link
Contributor

With this code, I'd expect (Neave, 1939a--b--1940a--b). What I actually get is (Neave, 1939a, b, 1940a, b).

With

<citation disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter=", " cite-group-delimiter="--">

then I get (Neave, 1939a--b--1940a--b). Which is not supposed to happen at least if I read the spec correctly? The spec clearly implies that cite-group-delimiter and collapse are not supposed to be used together ("Cite grouping can be activated by setting the cite-group-delimiter attribute or the collapse attributes"), but also does not state a behavior if both are defined.

And finally with <citation disambiguate-add-year-suffix="true" collapse="year-suffix"

I should get (Neave, 1939a; b; 1940a; b) according to the spec's own explicit example because the semicolon is set in "layout".

The same issue was discussed in citation-style-language/test-suite#50 and the current behavior seems incorrect. Besides, the grouping and collapsing procedures are also discussed in citation-style-language/schema#338.

I check the provided cases by creating a minimal test fixture. One may save it to fixures/local/test_Test.txt and then run cslrun -s test_Test.txt. Note that the author-short and issued-year macros are not provided in the original CSL code. I change them to names and date elements, respectively and they should not cause changes in the output. Unfortunately I don't reproduce all the results. @Circeus Did you get them from Zotero CSL editor or the online editor?

>>===== MODE =====>>
citation
<<===== MODE =====<<


>>===== RESULT =====>>
(Neave, 1939a--b--1940a--b)
<<===== RESULT =====<<


>>===== CITATION-ITEMS =====>>
[
    [
        {
            "id": "ITEM-1"
        },
        {
            "id": "ITEM-2"
        },
        {
            "id": "ITEM-3"
        },
        {
            "id": "ITEM-4"
        }
    ]
]
<<===== CITATION-ITEMS =====<<


>>===== CSL =====>>
<style
      xmlns="http://purl.org/net/xbiblio/csl"
      class="note"
      version="1.0">
  <info>
    <id />
    <title />
    <updated>2009-08-10T04:49:00+09:00</updated>
  </info>
  <citation disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter="--">
    <sort>
      <key variable="author"/>
      <key variable="issued"/>
    </sort>
    <layout delimiter="; " prefix="(" suffix=")">
      <group delimiter=" ">
        <names variable="author" suffix=",">
          <name form="short"/>
        </names>
        <date variable="issued" form="numeric" date-parts="year"/>
      </group>
    </layout>
  </citation>
</style>
<<===== CSL =====<<


>>===== INPUT =====>>
[
    {
        "id": "ITEM-1",
        "type": "book",
        "author": [
            {
                "family": "Neave",
                "given": "S.A."
            }
        ],
        "issued": {
            "date-parts": [
                [
                    "1939"
                ]
            ]
        }
    },
    {
        "id": "ITEM-2",
        "type": "book",
        "author": [
            {
                "family": "Neave",
                "given": "S.A."
            }
        ],
        "issued": {
            "date-parts": [
                [
                    "1939"
                ]
            ]
        }
    },
    {
        "id": "ITEM-3",
        "type": "book",
        "author": [
            {
                "family": "Neave",
                "given": "S.A."
            }
        ],
        "issued": {
            "date-parts": [
                [
                    "1940"
                ]
            ]
        }
    },
    {
        "id": "ITEM-4",
        "type": "book",
        "author": [
            {
                "family": "Neave",
                "given": "S.A."
            }
        ],
        "issued": {
            "date-parts": [
                [
                    "1940"
                ]
            ]
        }
    }
]
<<===== INPUT =====<<

I get the result

      + expected - actual

      -(Neave, 1939a--b; 1940a--b)
      +(Neave, 1939a--b--1940a--b)

The output (Neave, 1939a--b; 1940a--b) seems reasonable but it's not (Neave, 1939a, b, 1940a, b) from @Circeus.

With <citation disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter=", " cite-group-delimiter="--">, the output is exactly the same as (Neave, 1939a--b--1940a--b) and I agree that it's unexpected in the spec.

Finally with <citation disambiguate-add-year-suffix="true" collapse="year-suffix">, I get (Neave, 1939a; b; 1940a; b) which is exactly the expected result but it's not (Neave, 1939a, b, 1940a, b).

@Circeus
Copy link
Author

Circeus commented Oct 18, 2022

faunitaxys.txt

Here's the full code. Changing the year-suffix-delimiter in the online code editor (Zotero editor does not lat you change the code) has no effect, but if it's normal behavior, I haven't been able to figure out where I went wrong!

@zepinglee
Copy link
Contributor

faunitaxys.txt

Here's the full code. Changing the year-suffix-delimiter in the online code editor (Zotero editor does not lat you change the code) has no effect, but if it's normal behavior, I haven't been able to figure out where I went wrong!

@Circeus Where did you get the citation output (Neave, 1939a, b, 1940a, b)? In the Zotero -> Preferences -> Cite -> Style Editor?

I loaded the CSL style file as well as the provided entries and I get the following results in the Zotero style editor:

  • With collapse="year-suffix" year-suffix-delimiter="--": (Neave, 1939a--b, 1940a--b);
  • With collapse="year-suffix" year-suffix-delimiter=", " cite-group-delimiter="--": (Neave, 1939a--b--1940a--b) (same as yours);
  • With collapse="year-suffix": (Neave, 1939a; b, 1940a; b), which is different from your (Neave, 1939a, b, 1940a, b). I'm surprised it's not the same as in the test fixture. I'll dig into this later.

@Circeus What is your desired output for the style? I'll see if it's possible to implement. Please provide your expected citation for the following case.

  • (Doe, 1938; Jones, 1939a, b, 1940; Smith, 1941)

@Circeus
Copy link
Author

Circeus commented Oct 18, 2022

As I stated above, this is directly from the online editor (https://editor.citationstyles.org/codeEditor/).

@zepinglee
Copy link
Contributor

I just find the mistake in #215 (comment)'s fixture: the styles class should be "in-text" but it's mistakenly set to "note". After it's corrected, collapse="year-suffix" gives (Neave, 1939a, b, 1940a, b). It seems that citeproc-js treat note and in-text styles differently.

The cite-group-delimiter and year-suffix-delimiter problem here is a bug on the citeproc-js side. I'll try to make a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants