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

“Homer, .”: name with family and and empty given #161

Open
3 tasks done
glorieux-f opened this issue Aug 2, 2023 · 1 comment
Open
3 tasks done

“Homer, .”: name with family and and empty given #161

glorieux-f opened this issue Aug 2, 2023 · 1 comment

Comments

@glorieux-f
Copy link
Contributor

glorieux-f commented Aug 2, 2023

Please follow the general troubleshooting steps first:

  • I read the README and followed the instructions.
  • I am sure that the used CSL metadata follows the CSL schema.
  • 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 added a commit to glorieux-f/citeproc-php that referenced this issue Aug 3, 2023
@glorieux-f glorieux-f changed the title «Homer, .», name with family and and empty given “Homer, .”, name with family and and empty given Aug 6, 2023
@glorieux-f glorieux-f changed the title “Homer, .”, name with family and and empty given “Homer, .”: name with family and and empty given Aug 6, 2023
@rbran100
Copy link
Contributor

@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. ."

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

2 participants