citeproc-php
citeproc-php copied to clipboard
“Homer, .”: name with family and and empty given
Please follow the general troubleshooting steps first:
- [x] I read the README and followed the instructions.
- [x] I am sure that the used CSL metadata follows the CSL schema.
- [x] I use a valid CSL stylesheet
Bug reports:
The default CSL export of Zotero desktop output an empty given ("given": "") when a name has no given.
citeproc-php display it with an empty string after a comma.
- Homer, . (s. d.). Odyssey (family, given=’’).
Zotero desktop export
- Homer. (s. d.). Odyssey (family, given=’’).
Fix, find the right test where given should be not empty. Candidate Rendering/Name/Name.php#L187,
if ($useInitials && isset($nameItem->given) && !empty($nameItem->given)) {…}
Used CSL stylesheet:
apa.csl
Used CSL metadata
Please replace these lines with your used metadata, for instance:
[
{
"id": "id03",
"type": "book",
"title": "Odyssey (family, given='')",
"author": [
{
"family": "Homer",
"given": ""
}
]
},
{
"id": "id02",
"type": "book",
"title": "Odyssey (family)",
"author": [
{
"family": "Homer"
}
]
}
]
@glorieux-f I can confirm that this fix works for me, it was the main issue I was having along with #169
Can I suggest an additional change, pass "$nameItem->given" through trim before passing it to initializeBySpaceOrHyphen, while it is not strictly cite-procs wheelhouse it prevents "First " from becoming "F. ."