-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support Zotero citations in docx #7840
Comments
So is the idea to parse this from docx into a native pandoc Cite inline? |
Can you upload a complete document containing these, for testing? |
Hi @jgm, here's a DOCX with a number of references (including prefixes etc.) for testing. I included the reference list generated by Zotero which looks like it would not be needed if we have the original in-text citations. |
So far this just adds a constructor for FieldInfo; we'll need to adjust the rest of the reader code to parse the JSON and do something with it. See #7840.
Would there be any further detailed explanation about this change in user guide? As far as I understood, Zotero fields are now automaticlaly converted into |
Not yet. We've only implemented the skeleton for this so far. |
Can someone upload a sample docx using these Zotero fields? It would be good if it demonstrated the following:
|
Adding an example:
The first line creates two citations with 2 (Jones & Smith) and 1 citation item (Jones). The item date data from the citations in the re-used book are the same (in this case id is 273 in both cases). The second line contains the item data for Smith again (same ID 272 as in the first citation). The locator chapter is added to the citation item. If you need anything else (or would like a discussion on the JSON structures, I'd be happy to help). |
Here's a formatted version of the embedde JSON in the above example: {
"citationID": "AQwSemPs",
"properties": {
"formattedCitation": "(Hawking, 2010)",
"plainCitation": "(Hawking, 2010)",
"noteIndex": 0
},
"citationItems": [
{
"id": 46,
"uris": [
"http://zotero.org/users/40613/items/EAG35HWU"
],
"uri": [
"http://zotero.org/users/40613/items/EAG35HWU"
],
"itemData": {
"id": 46,
"type": "article-journal",
"title": "Test article one",
"author": [
{
"family": "Hawking",
"given": "Stephen"
}
],
"issued": {
"date-parts": [
[
"2010"
]
]
}
}
}
],
"schema": "https://github.com/citation-style-language/schema/raw/master/csl-citation.json"
} |
We'll need to modify the CitationItem type in citeproc to allow this kind of embedded itemData:
After that, we can simply use the FromJSON instance for Citeproc.Citation to parse this. And then we'll need to (a) convert this to a Pandoc.Citation and (b) extract the embedded Reference and put it in state, so it can be added to the |
- Add docxReferences to state, so we can accumulate references for metadata. - Add a clause for ZoteroItem to parPartToInlines'. So far it doesn't do anything except add a surrounding Cite element. See #7840.
This gives us what we ned for #7840, except adding to the references in metadata.
These are supported in the same way as Zotero citations, using the same code. As with Zotero, enable the `citations` extension on `docx` to parse these as native citations. Closes #7840.
Sample code:
My understanding is that the XML element comes with a full CSL JSON entry, so this we can parse that.
The text was updated successfully, but these errors were encountered: