Juris-M / citeproc-js

A JavaScript implementation of the Citation Style Language (CSL) https://citeproc-js.readthedocs.io
Other
310 stars 85 forks source link

No-repeat suppressing value, even if it's only actually supposed to be rendered once #182

Open Tomagori opened 3 years ago

Tomagori commented 3 years ago

See forum post.

When citing two items that have the same authority, but that are cited differently, the authority is still omitted in the second citation even if the first citation does not include the authority.

In my case, I'm citing two cases by the same authority, one of which is included in a collection, the other one is not. I cite the first one with [collection-number], [locator], the other with [authority] [number], [locator]. But because both cases were decided by the same authority, the [authority] is never rendered, even though, visually, it would not constitute a repeat.

>>== MODE ==>>
citation
<<== MODE ==<<

>>===== CITATION-ITEMS =====>>
[
    [
        {
            "id": "BGE115Ia1989"
        }, 
        {
            "id": "BGer1A3642002"
        }
    ]
]
<<===== CITATION-ITEMS =====<<

>>== RESULT ==>>
BGE 115 Ia 234; BGer 1A.364/1999 (12.4.2002).
<<== RESULT ==<<

>>===== CSL =====>>
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.1mlz1" default-locale="de-CH" page-range-format="minimal">
  <info>
    <title>test</title>
    <id>test</id>
    <link href="test" rel="self"/>
    <link href="http://juris-m.github.io" rel="documentation"/>
    <author>
      <name>Tomagori</name>
    </author>
    <category citation-format="note"/>
    <category field="law"/>
    <summary>test of no-repeat issue</summary>
    <updated>2021-04-27</updated>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
  </info>
  <locale xml:lang="de-CH">
    <terms>
      <term name="division" form="short"></term>
    </terms>
  </locale>
  <macro name="issued-date">
    <date variable="issued" prefix="(" suffix=")">
      <date-part name="day" form="numeric" suffix="."/>
      <date-part name="month" form="numeric" suffix="."/>
      <date-part name="year"/>
    </date>
  </macro>
  <macro name="locator-note">
    <group delimiter="&amp;#x00A0;">
      <label variable="locator" form="short" text-case="capitalize-first"/>
      <text variable="locator"/>
    </group>
  </macro>
  <citation>
    <layout delimiter="; " suffix=".">
      <choose>
        <if type="legal_case" match="any">
          <choose>
            <if match="any" variable="division">
              <group delimiter=" ">
                <group no-repeat="container-title">
                  <text variable="container-title"/>
                </group>
                <number variable="collection-number"/>
                <number variable="division"/>
                <number variable="page-first"/>
                <text macro="locator-note"/>
              </group>
            </if>
            <else match="any" variable="authority">
              <group delimiter=" ">
                <group no-repeat="authority">
                  <names variable="authority">
                    <name/>
                    <institution form="short"/>
                  </names>
                </group>
                <number variable="number"/>
                <text variable="title-short" font-style="italic"/>
                <text macro="issued-date"/>
                <text variable="container-title" prefix="in "/>
                <group delimiter=", ">
                  <number variable="collection-number"/>
                  <number variable="volume" prefix="Nr. "/>
                  <number variable="page-first"/>
                </group>
                <text macro="locator-note"/>
              </group>
            </else>
          </choose>
        </if>
        <else>
          <!-- nothing -->
        </else>
      </choose>
    </layout>
  </citation>
</style>

<<===== CSL =====<<

>>===== INPUT =====>>
[
    {
        "id": "BGE115Ia1989",
        "type": "legal_case",
        "multi": {
            "main": {},
            "_keys": {}
        },
        "authority": "BGer",
        "collection-number": "115",
        "container-title": "BGE",
        "language": "de-CH",
        "page": "234",
        "title": "BGE 115 Ia 234",
        "jurisdiction": "ch",
        "division": "Ia",
        "issued": {
            "date-parts": [
                [
                    "1989",
                    3,
                    15
                ]
            ]
        }
    },
    {
        "id": "BGer1A3642002",
        "type": "legal_case",
        "multi": {
            "main": {},
            "_keys": {}
        },
        "authority": "BGer",
        "language": "de-CH",
        "number": "1A.364/1999",
        "title": "BGer 1A.364/1999",
        "jurisdiction": "ch",
        "issued": {
            "date-parts": [
                [
                    "2002",
                    4,
                    12
                ]
            ]
        }
    }
]
<<===== INPUT =====<<
bwiernik commented 3 years ago

Can you write this as a test? e.g., look here for an example: https://github.com/Juris-M/citeproc-js/blob/master/fixtures/local/parallel_BrokenParallel.txt

You should include a minimal style that should produce the output you want, the item data for the two items, and the correctly rendered result.

Tomagori commented 3 years ago

Thanks for the swift reply, I updated my post, hope this is correct. RESULT is now the intended result (I assumed this is what you mean by correctly rendered), Juris-M actually renders it without the "BGer", which is the issue.

georgd commented 3 years ago

Thank you @Tomagori this issue posting was on my to-do-list for this week.

This improvement is necessary for at least Swiss and German legal citation.