seboettg / citeproc-php

Full-featured CSL 1.0.1 processor for PHP
MIT License
73 stars 38 forks source link

Chicago Style Troubles: double place, trans. before. #113

Closed urshofer closed 2 years ago

urshofer commented 2 years ago

Please follow the general troubleshooting steps first:

Thanks for your great Work!

I have the following Issue, using chicago-fullnote-bibliography-16th-edition.

This is the metadata:

{
        "type": "book",
        "id": "williams_daniele_2019",
        "citation-label": "williams_daniele_2019",
        "issued": {
            "date-parts": [
                [
                    2019
                ]
            ]
        },
        "publisher-place": "[Basel]",
        "publisher": "Birkhäuser",
        "title": "Daniele Barbaro’s Vitruvius of 1567",
        "translator": [
            {
                "given": "Kim",
                "family": "Williams"
            }
        ]
    }

Is rendered like this:

, trans.Williams, Kim. Daniele Barbaro’s Vitruvius of 1567. [Basel]: Birkhäuser, 2019, [Basel]: Birkhäuser, 2019.

Should be rendered:

Williams, Kim, trans. Daniele Barbaro’s Vitruvius of 1567. [Basel]: Birkhäuser, 2019.

(Test made with https://editor.citationstyles.org/visualEditor/)

Any hints - I'm quite new to csl, worked with BibLaTex before.

Thanks!

urshofer commented 2 years ago

So, it's in this macro:

  <macro name="translator">
    <names variable="translator">
      <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="always" name-as-sort-order="first"/>
      <label form="verb-short" prefix=", "/>
    </names>
  </macro>

Where , trans. is always preceeding, which is only correct if the author/editor is existing.

urshofer commented 2 years ago

I further pinned down the issue.

In the csl file there are several constructions like this:

<choose>
    <if type="speech" variable="publisher publisher-place" match="any">
        <text macro="issue"/>
    </if>
</choose>

If I rewrite the construction like this

<choose>
    <if type="speech">
        <choose>
            <if variable="publisher publisher-place" match="any">
                <text macro="issue"/>
            </if>
        </choose>
    </if>
</choose>

It works as expected.

It looks like the scope of match="any" is different between the standard implementation as seen on https://editor.citationstyles.org/visualEditor and citeproc-php. First is testing both (type && variable||variable||variable), latter probably (type || variable || variable …) or ignoring type at all.

jmvezic commented 2 years ago

@urshofer I'm having the same issue. Is this a problem with the CSL file or with citeproc-php's handling of the CSL file? How come citeproc-js doesn't have this same issue?

urshofer commented 2 years ago

I guess the bug is on citeproc-php's side. I did not have time to investigate further, so i changed the csl file a little bit to make it run with citeproc-php.

Am 18.05.2022 um 15:49 schrieb Jakov M. Vežić @.***>:

@urshofer https://github.com/urshofer I'm having the same issue. Is this a problem with the CSL file or with citeproc-php's handling of the CSL file? How come citeproc-js doesn't have this same issue?

— Reply to this email directly, view it on GitHub https://github.com/seboettg/citeproc-php/issues/113#issuecomment-1130041921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA4R4AKHDSNEGDEYXGDUM3VKTYM7ANCNFSM5N6LFLCA. You are receiving this because you were mentioned.

jmvezic commented 2 years ago

Can you reopen the issue in that case? I'd like to keep syncing the CSL files with the upstream repository as updates come along, and having (unneeded) local changes to those in order to resolve this issue is kind of messy.

seboettg commented 2 years ago

Hi @jmvezic! Please check if the issue is solved with version 2.4.2.

jmvezic commented 2 years ago

Yeap, solved with 2.4.2!

As an aside, Composer wouldn't pick up the 2.4.2 version for some reason, even with ^2. I had to specifically say 2.4.2.