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

Delimiters in disambiguate_InitializeWithButNoDisambiguation #56

Closed
Jason-Abbott opened this issue May 5, 2023 · 5 comments
Closed

Comments

@Jason-Abbott
Copy link
Contributor

I am stumped on disambiguate_InitializeWithButNoDisambiguation. My result is

(Doe, 1965a; 1965b)

but the expected result is

(Doe, 1965a, 1965b)

I am not seeing the setting that would override <layout delimiter=“;”> for use between the two citations — at least not in a way that still passes the other tests.

I think it must be simple but reading previous issues like #50 hasn’t turned on a lightbulb yet. This is the relevant content:

<citation et-al-min="4" et-al-use-first="3" disambiguate-add-year-suffix="true" collapse="year">
    <layout prefix="(" suffix=")" delimiter="; ">
        <group delimiter=", ">
            <text macro="author-short"/>
            <text macro="year-date"/>
            <group>
             <label variable="locator" suffix="*" form="short" strip-periods="true"/>
              <text variable="locator"/>
            </group>
          </group>
    </layout>
</citation>
[
	{
		"author": [{ "family": "Doe", "given": "John" }],
		"id": "ITEM-1",
		"issued": { "date-parts": [["1965"]] },
		"title": "His Anonymous Life",
		"type": "book"
	},
	{
		"author": [{ "family": "Doe", "given": "Heroclitus" }],
		"id": "ITEM-2",
		"issued": { "date-parts": [["1965"]] },
		"title": "His Anonymous Second Life",
		"type": "chapter"
	}
]
@adam3smith
Copy link
Member

That's actually speced: cite-group-delimiter defaults to ", "

@bwiernik bwiernik closed this as completed May 6, 2023
@Jason-Abbott
Copy link
Contributor Author

Thank you, @adam3smith. That’s an easy change but it breaks at least one other test, disambiguate_YearSuffixWithEtAlSubsequent.

If I have cite-group-delimiter default to ", " before using <layout delimiter="; "> then I get

(Smith 2000a, 2000b, 2000c)

for the first line of that test instead of what it expects,

(Smith 2000a; 2000b; 2000c)

The two test’s citation attributes look very similar (below). What I do see is different is that one has class="in-text” citations and the other class=“note”. And if memory serves (I’ll go check now), that can magically change the cite-group-delimiter behavior.

  • et-al-min="3"
  • et-al-use-first="1"
  • et-al-subsequent-min="3"
  • et-al-subsequent-use-first="1"
  • disambiguate-add-names="true"
  • disambiguate-add-year-suffix="true"
  • collapse=“year”
  • [layout delimiter]="; "
  • et-al-min=“4"
  • et-al-use-first=“3”
  • disambiguate-add-year-suffix=“true"
  • collapse=“year"
  • [layout delimiter]="; "

@Jason-Abbott
Copy link
Contributor Author

Jason-Abbott commented May 6, 2023

There are probably enough delimiter threads out there. I’m happy to keep plugging along and figure it out. This is where I saw “in-text” might be relevant, though I’ve not bothered to fully parse this section of code https://github.com/Juris-M/citeproc-js/blob/84a3916a20fc33ab53a2b57a8af1fe3b9d82452c/src/api_cite.js#L892

@Jason-Abbott
Copy link
Contributor Author

Jason-Abbott commented May 6, 2023

Final note on this: I adjusted my code as follows and it’s passing both kinds of tests. Citations that are in-text use the default “, “ if cite-group-delimiter isn’t set. Otherwise, the layout delimiter is tried first before falling back to the default.

citationGroupingDelimiter
    ?? (placement == .inText
           ? CitationElement.defaultDelimiter
           : layout.delimiter ?? CitationElement.defaultDelimiter)

We’ll see how far this takes me 😄

@zepinglee
Copy link
Contributor

Great! This solves my confusion.

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

4 participants