Citoid/Maps TemplateData
Example of TemplateData skeleton with empty maps value
editBelow, a barebone example of templateData that shows you how the 'maps' key fits in with the rest of the templateData. 'maps' values correspond to the name of the service being used, in this case 'citoid.'. The values in the citoid object must be valid 'params' (i.e. in this case, 'foo' - aliases are not allowed); 'maps' keys, i.e. 'bar' here, correspond to keys coming from the citoid service.
"description": null,
"params": {
"foo": {
"label": null,
"description": null,
"default": null,
"example": null,
"required": false,
"suggested": false,
"deprecated": false,
"aliases": [],
"type": "unknown",
"autovalue": null
}
},
"paramOrder": [
"foo"
],
"sets": [],
"maps": {
"citoid": {
"bar": "foo"
}
}
A citation with the field "bar"
edit[{
bar: 'Bar value'
}]
Resulting template
edit{{mytemplate|foo = Bar value}}
Real example
editThis is an example of a partial 'maps' value from the Cite journal template on en wiki. The full templateData can be viewed on the page source.
"maps": {
"citoid": {
"title": "title",
"url": "url",
"publisher": "publisher",
"publicationTitle": "journal",
"proceedingsTitle": "journal",
"bookTitle": "journal",
"date": "date",
"place": "location",
"ISSN": ["issn"],
"ISBN": ["isbn"],
"PMCID": "pmc",
"PMID": "pmid",
"oclc": "oclc",
"pages": "pages",
"volume": "volume",
"series": "series",
"seriesNumber": "volume",
"archiveUrl": "archive-url",
"archiveDate": "archive-date",
"issue": "issue",
"DOI": "doi",
"language": "language",
"author": [
[ "first", "last" ],
[ "first2", "last2" ],
[ "first3", "last3" ]
],
"editor": [
["editor-first", "editor-last"],
["editor2-first", "editor2-last"],
["editor3-first", "editor3-last"],
]
}
}
Available fields and field structure
editA complete list of fields for each zotero type is available from the Zotero type map.[1] These largely match the citoid fields. However, there are some exceptions.
In 'zotero' format, the field "creators" is a structured object that contains a list of creators with the creator type. In the 'mediawiki' format, the creatorType is transformed into a key. So instead of the creators key, there will be an 'editor' key as well as 'author', 'contributor', and 'translator' keys. These correspond to a two dimensional array, or matrix, which map onto the first and last names of the creators. If there is only one name for the contributor, the first value (representing the first name) will be an empty string, and the value will be in the second position (representing the last or second name).
The other way mediawiki fields differ is that the values for ISSN and ISBN are lists, not strings.
On the type map, sometimes there is a base field in parentheses, i.e. websiteTitle (publicationTitle). Where this is the case, you will get the specific field type, i.e. websiteTitle. If your template handles multiple itemTypes and you've requested mediawiki format, you should include all of the synonyms in the map.
Simple Arrays (lists)
editISSN and ISBN fields are simple lists. If you want to ensure that exactly one ISBN or ISSN goes in the field, (for example, if your template validates the ISBN or ISSN) your template data should look like so:
"maps": {
"citoid": {
"ISBN": ["isbn"]
}
}
This will result in the template:
{{Cite journal|isbn = 978-3-16-148410-0}}
If you want to include all available ISBNs in your template, your template should look like so:
"maps": {
"citoid": {
"ISBN": "isbn"
}
}
The resulting template will include all available ISBNs as a comma-separated string:
{{Cite journal|isbn = 978-3-16-148410-0, 978-8175257665}}
If you have multiple isbn fields that can allow a single ISBN:
"maps": {
"citoid": {
"ISBN": ["isbn", "isbn2"]
}
}
The resulting template will be:
{{Cite journal|isbn = 978-3-16-148410-0|isbn2 = 978-8175257665}}
Two-dimensional Arrays (list of lists)
editAll Zotero creator types[2] are available as a list of lists: artist, attorneyAgent, author, bookAuthor, cartographer, castMember, commenter, composer, contributor, cosponsor, counsel, director, editor, guest, interviewee, interviewer, inventor, performer, podcaster, presenter, producer, programmer, recipient, reviewedAuthor, scriptwriter, seriesEditor, sponsor, translator, wordsBy.
For the template data should be as follows:
"maps": {
"citoid": {
"author": [
[ "first", "last" ],
[ "first2", "last2" ]
]
}
}
The resulting template will be:
{{Cite journal|first = Anne E.|last = Pusey|first2 = Craig|last2 = Packer}}
However, not all templates have separate fields for first and last names. For templates with separate fields for each author only, the template data should be as follows:
"maps": {
"citoid": {
"author": ["last", "last2"]
}
}
The resulting template will be:
{{Cite journal|last = Anne E. Pusey|last2 = Craig Packer}}
For the template data should be as follows:
"maps": {
"citoid": {
"author": "last"
}
}
The resulting template will be:
{{Cite journal|last = Anne E. Pusey, Craig Packer}}