seboettg / citeproc-php

Full-featured CSL 1.0.1 processor for PHP
MIT License
75 stars 39 forks source link

Group delimiter not being applied #70

Closed ghost closed 4 years ago

ghost commented 4 years ago

Bug reports:

I'll start by saying I'm not 100% sure it is a bug... but no comma is put between "collection-title" and "collection-number". This happens because both the Choose and ChooseIf classes are imploding the result. When the results reaches the Group, it is a simple string and not an array, therefor no delimiter is inserted. Could not clarify this with the specification if it should work or not. It says

The Group rendering element must contain one or more rendering elements (with the exception of cs:layout)

in http://docs.citationstyles.org/en/stable/specification.html#group

...and the Choose is a rendering element, however the If is not....so not sure. I can also say that Zotero does print this with the comma in between both variables, and I'm using it's output as reference.

My output (note the missing comma+space before '95-2'):

Josephson, Nors S., ed., Early Sixteenth-Century Sacred Music from the Papal Chapel, Corpus Mensurabilis Musicae95–2 (Neuhausen-Stuttgart: American Institute of Musicology, Hänssler-Verlag, 1982), II

Zotero's output:

Josephson, Nors S., ed., Early Sixteenth-Century Sacred Music from the Papal Chapel, Corpus Mensurabilis Musicae, 95–2 (Neuhausen-Stuttgart: American Institute of Musicology, Hänssler-Verlag, 1982), II

What do you think?

Used CSL stylesheet:

modern-humanities-research-association specifically this part

<macro name="collection-title">
    <group delimiter=", ">
      <choose>
        <if type="article-journal">
          <text variable="collection-title"/>
          <text variable="collection-number"/>
        </if>
        <else>
          <text variable="collection-title" text-case="title"/>
          <text variable="collection-number"/>
        </else>
      </choose>
    </group>
  </macro>

Used CSL metadata

[{
   "id":"7021352\/UTSP92QZ",
   "type":"book",
   "title":"Early Sixteenth-Century Sacred Music from the Papal Chapel",
   "collection-title":"Corpus Mensurabilis Musicae",
   "collection-number":"95-2",
   "publisher":"American Institute of Musicology, Ha\u0308nssler-Verlag",
   "publisher-place":"Neuhausen-Stuttgart",
   "volume":"II",
   "event-place":"Neuhausen-Stuttgart",
   "language":"en",
   "editor":[
      {
         "family":"Josephson",
         "given":"Nors S."
      }
   ],
   "issued":{
      "date-parts":[
         [
            1982
         ]
      ]
   }
}]
ghost commented 4 years ago

Hi @seboettg,

tested with master branch and this fix/improvement is working as expected, at least for the scenario of this issue :)

Thanks