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

Citation Key blocks following fields in note #231

Open
denismaier opened this issue Sep 27, 2023 · 13 comments
Open

Citation Key blocks following fields in note #231

denismaier opened this issue Sep 27, 2023 · 13 comments

Comments

@denismaier
Copy link
Contributor

denismaier commented Sep 27, 2023

Depending on where citation-key is in note, later fields may not be recognized by citeproc-js. See retorquere/zotero-better-bibtex#2658 (I first thought it might be a BBT issue, but apparently it is not.)

With the three items and the minimal style below, I'm getting the following results:

  1. Citation Key directly above Event date -> "match" -> Event Date not used
  2. Citation Key last in Extra -> "10. Mai 2001match" -> as expecte
  3. Citation Key first in Extra -> "10. Mai 2001match" -> as expected
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
  <info>
    <title>event-date-test</title>
    <id>http://www.zotero.org/styles/event-date-test</id>
    <link rel="self" href="http://www.zotero.org/styles/event-date-test"/>
    <updated>2023-09-20T12:11:03+00:00</updated>
  </info>
  <citation>
    <layout>
      <date form="text" variable="event-date"/>
    </layout>
  </citation>
  <bibliography>
    <layout>
      <date form="text" variable="event-date"/>
      <choose>
        <if type="performance" match="any">
          <text value="match"/>
        </if>
      </choose>
    </layout>
  </bibliography>
</style>
[
	{
		"id": "nachwilliamshakespeareHamlet2001",
		"type": "graphic",
		"abstract": "Theateraufführung",
		"note": "type: performance\ndirector: Schlingensief || Christoph\npublisher-place: Schauspielhaus Zürich, Pfauen\nevent-date: 2001-05-10",
		"title": "Hamlet nach William Shakespeare",
		"issued": {
			"date-parts": [
				[
					"2001",
					5,
					10
				]
			]
		}
	},
	{
		"id": "HamletNachWilliam2001",
		"type": "graphic",
		"abstract": "Theateraufführung",
		"note": "type: performance\nevent-date: 2001-05-10",
		"title": "Hamlet nach William Shakespeare 2",
		"issued": {
			"date-parts": [
				[
					"2001",
					5,
					10
				]
			]
		}
	},
	{
		"id": "eventDateTest",
		"type": "graphic",
		"abstract": "Theateraufführung",
		"note": "type: performance\nevent-date: 2001-05-10",
		"title": "Hamlet nach William Shakespeare 3",
		"issued": {
			"date-parts": [
				[
					"2001",
					5,
					10
				]
			]
		}
	},
	{
		"id": "nachwilliamshakespeareHamlet2001a",
		"type": "graphic",
		"abstract": "Theateraufführung",
		"note": "event-date: 2001-05-10\ntype: performance\ndirector: Schlingensief || Christoph\npublisher-place: Schauspielhaus Zürich, Pfauen",
		"title": "Hamlet nach William Shakespeare 4",
		"issued": {
			"date-parts": [
				[
					"2001",
					5,
					10
				]
			]
		}
	},
	{
		"id": "schlingensiefHamletNachWilliam2001",
		"type": "graphic",
		"abstract": "Theateraufführung",
		"note": "type: performance\ndirector: Schlingensief || Christoph\nevent-date: 2001-05-10\npublisher-place: Schauspielhaus Zürich, Pfauen",
		"title": "Hamlet nach William Shakespeare 5",
		"issued": {
			"date-parts": [
				[
					"2001",
					5,
					10
				]
			]
		}
	}
]

Or is this a problem with how Zotero hands the data over to citeproc-js rather than a citeproc-js issue proper?

@larsgw
Copy link
Collaborator

larsgw commented Sep 27, 2023

I don't see citation-key (or Citation Key) in the note field of any of the input items? Might be Zotero in that case?

@denismaier
Copy link
Contributor Author

You're right of course. The Citation Key ends up in id. And, interestingly, the other data also seems to be there, but this here doesn't work quite as it should:

grafik

grafik

But:

grafik

grafik

So:

  • Citation Key in the middle -> match on type works, but event-date is not there.
  • Citation Key on top -> match on type works, and event-date is there.

Any ideas?
Maybe @dstillman might be also interested in this.

@bwiernik
Copy link
Contributor

This might be some leftover behavior from creating alignment with BetterBibTeX? @retorquere

@retorquere
Copy link
Collaborator

I haven't been able to find anything. Not in citeproc-js, not in the Zotero sources. It's in the translators, but I don't think these are involved.

@larsgw
Copy link
Collaborator

larsgw commented Sep 29, 2023

Okay, I think I've found it. (First off, when exporting to CSL-JSON the Citation Key field is (re)moved, but this is not the case when generating CSL-JSON for citeproc-js). Zotero transforms "Citation Key" to "citation-key", but this field is not recognized as a CSL-JSON field, and the transformation is canceled (code). "Citation Key" is not a valid variable name (docs, code). Citeproc only parses the note contents up to the first line that does not contain a note field, with the exception that the first line can contain anything:

Conforming braced-entries and line-entries must occur at the top of the note field. The set of entries may begin on the first or the second line of the field: parsing stops when the parser encounters a non-empty line after the first that does not fit the descriptions above. Parsed entries are removed from the note field before onward processing.

docs, code

@larsgw
Copy link
Collaborator

larsgw commented Sep 29, 2023

Depending on whether the Citation Key should be available to citeproc or not, the field should either be mapped correctly to citation-key or removed altogether. In general, the behavior of not modifying unrecognized fields can probably lead to problems down the line.

@bwiernik
Copy link
Contributor

citation-key is a CSL variable. It should be available to citeprocs

@larsgw
Copy link
Collaborator

larsgw commented Sep 29, 2023

Would zotero/utilities#29 work?

@bwiernik
Copy link
Contributor

I think so (and more broadly we need to add the other new variables in CSL 1.0.2 to that list)

@larsgw
Copy link
Collaborator

larsgw commented Sep 29, 2023

I'll work on it.

@bwiernik
Copy link
Contributor

Thanks--I noticed that that needed to be updated a week or so ago and haven't found time to track down exactly where

@larsgw
Copy link
Collaborator

larsgw commented Sep 30, 2023

I've added them. It might also be useful to move non-CSL fields to the bottom of the field list (to avoid this confusing behavior for typos etc.) but I can imagine that that could cause other issues.

@denismaier
Copy link
Contributor Author

Thanks.

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