seboettg / citeproc-php

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

Dot is rendered below item if DOI is not set #92

Closed RazielleS closed 3 years ago

RazielleS commented 3 years ago

Please follow the general troubleshooting steps first:

Bug reports:

image

When there is no DOI set, one . is rendered below the item. This does not happen when testing on https://editor.citationstyles.org/visualEditor/. Although I need to change the DOI from null to an empty string there, otherwise it does not work at all. This does not work here. When changing to an empty string, an empty DOI is rendered instead: image

Used CSL stylesheet:

acm-sig-proceedings-long-author-list

Used CSL metadata

[
  {
    "type": "article-journal",
    "title": "[Book Review on] Margit V. Wunsch Gaarmann: The War in Our Backyard: The Bosnia and Kosovo Wars through the Lens of the German Print Media. Berlin 2015",
    "collection-title": null,
    "collection-number": null,
    "container-title": "Laboratorium 2015",
    "abstract": "The wars in Bosnia (1992–1995) and Kosovo (1998–1999) caused Germany to seriously consider military intervention abroad for the first time since the Second World War. The political stance taken by the then-recently reunited Germany towards the so-called Balkan wars was largely negotiated by the national public press. In The War in Our Backyard Margit V. Wunsch Gaarmann analyses how these two wars—and the political debates they triggered—were portrayed by the German press. Her study can be seen as a part of a larger field of research dealing with the connection between media and war. In her book Gaarmann presents a differentiated image of the German media, demonstrating that reports were far more controversial than suggested by the academic literature to date.",
    "page": "206-209",
    "number-of-pages": null,
    "event-place": null,
    "event-date": null,
    "ISSN": "2076-8214",
    "ISBN": null,
    "language": null,
    "genre": null,
    "country": null,
    "volume": 7,
    "issue": 2,
    "publisher": "CNSI",
    "publisher-place": null,
    "keyword": null,
    "DOI": null,
    "PMID": null,
    "note": "Publication type according to Uni Basel Research Database: Journal article",
    "URL": null,
    "author": [
      {
        "family": "Freiermuth Samardzic",
        "given": "Nadine"
      }
    ],
    "editor": [],
    "issued": {
      "date-parts": [
        [
          "2015"
        ]
      ]
    }
  }
]
seboettg commented 3 years ago

Hi @RazielleS! Thank you for this report! I fixed the bug. But it doesn't matter whether the DOI is set or not. citeproc-php as well as citeproc-js can not always handle CSL input data that contains null values/empty values. So it would be better to cleanup the data before try to render it.

For a test case I removed all empty values (empty strings, empty arrays, null values) and everything works fine with both, citeproc-php and citeproc-js

[
    {
        "ISSN": "2076-8214", 
        "abstract": "The wars in Bosnia (1992–1995) and Kosovo (1998–1999) caused Germany to seriously consider military intervention abroad for the first time since the Second World War. The political stance taken by the then-recently reunited Germany towards the so-called Balkan wars was largely negotiated by the national public press. In The War in Our Backyard Margit V. Wunsch Gaarmann analyses how these two wars—and the political debates they triggered—were portrayed by the German press. Her study can be seen as a part of a larger field of research dealing with the connection between media and war. In her book Gaarmann presents a differentiated image of the German media, demonstrating that reports were far more controversial than suggested by the academic literature to date.", 
        "author": [
            {
                "family": "Freiermuth Samardzic", 
                "given": "Nadine"
            }
        ], 
        "container-title": "Laboratorium 2015", 
        "issue": 2, 
        "issued": {
            "date-parts": [
                [
                    "2015"
                ]
            ]
        }, 
        "note": "Publication type according to Uni Basel Research Database: Journal article", 
        "page": "206-209", 
        "publisher": "CNSI", 
        "title": "[Book Review on] Margit V. Wunsch Gaarmann: The War in Our Backyard: The Bosnia and Kosovo Wars through the Lens of the German Print Media. Berlin 2015", 
        "type": "article-journal", 
        "volume": 7
    }
]
seboettg commented 3 years ago

@RazielleS One more thing: Please checkout branch issue-92, test the fix and confirm it when everything works as expected. Thank you!

RazielleS commented 3 years ago

@seboettg Thank you, the bugfix is working.

I'll have a look if we can remove the null values somehow. Thanks for the suggestion.

seboettg commented 3 years ago

I'm glad to hear that. I'm going to make a hotfix release soon.

seboettg commented 3 years ago

Hi @RazielleS! Version 2.2.2 has been released and contains this fix. I will close this bug report now. If you have some trouble with the described bug, feel free to reopen this ticket.