jgm / citeproc

CSL citation processing library in Haskell
BSD 2-Clause "Simplified" License
154 stars 16 forks source link

Locator label affecting page range label #107

Closed JohnCWood closed 2 years ago

JohnCWood commented 2 years ago

I originally posted this issue at Citation Style Language, but an admin there suggested it was probably a citeproc bug and to post it here.

In adapting a CSL style for my institution’s house style, I’ve run into an issue that seems to involve locator labels (p./pp.) affecting page range labels.

I am using pandoc (2.18) / citeproc (0.7) to convert markdown to docx. Bibliographic references are in a json file, created with Zotero.

In our house style, for say chapters and articles, the first citation should give both the full page range as well as, if necessary, the specifically cited range of pages.

However, when the locator is a single page (p.), the label for the full page range also reverts to singular (p.); if the locator is plural, both labels are “pp.” (as expected).

The image below shows the results, which affects both book chapters and journal articles: if the locator is "p." then the full page range in the citation is also "p.". (When adding citations directly via Zotero into LibreOffice document, the issue does not arise.)

image

I have attached my markdown file. I don't seem to be able to attach the json and csl files, but can link to them.

CSL file

json bibliography

(I tried to reduce the CSL to a minimum, but it kept then throwing up errors and I'm not all that skilled with CSL, so sorry that it's the full CSL file.)

I'm happy to provide any further info if it's helpful.

CSL-Test-5.md

denismaier commented 2 years ago

Here's a more minimal example that demonstrates the issue.

Markdown with references:

---
title: test
references:
- accessed: 2021-01-19
  author:
  - family: Barbour
    given: Ian G.
  citation-key: barbour_justice_1979
  container-title: Ecumenical Review
  container-title-short: Ecumenical Review
  DOI: 10.1111/j.1758-6623.1979.tb02528.x
  id: barbour_justice_1979
  ISSN: 00130796
  issue: 4
  issued: 1979-10
  language: en-GB
  page: 380-387
  publisher: Wiley-Blackwell
  source: EBSCOhost
  title: Justice, participation and sustainability at MIT
  title-short: Justice, participation and sustainability
  type: article-journal
  URL: "http://libezproxy.open.ac.uk/login?url=https://search.ebscohost.com/login.aspx?direct=true&db=a9h&AN=6431771&site=ehost-live&scope=site"
  volume: 31
- author:
  - family: Latourette
    given: Kenneth S.
  citation-key: latourette_community_1938
  collection-number: 5
  collection-title: Church, community and state
  container-title: Church and community
  editor:
  - family: Latourette
    given: Kenneth S.
  - family: Barker
    given: Ernest
  - family: Boegner
    given: Marc
  - family: Lilje
    given: Hanns
  - family: Björkquist
    given: Manfred
  - family: Zankov
    given: Stefan
  - family: Aubrey
    given: Edwin E.
  - family: Douglass
    given: H. Paul
  event-place: Chicago
  id: latourette_community_1938
  issued: 1938
  language: en-GB
  page: 3-17
  publisher: Willett, Clark & Company
  publisher-place: Chicago
  title: "Community and church: an historical survey and interpretation"
  title-short: Community and church
  type: chapter
- author:
  - family: Oldham
    given: J. H.
  citation-key: oldham_responsible_1948
  collection-number: 3
  collection-title: Man's disorder and God's design
  container-title: The church and the disorder of society
  editor:
  - family: Bates
    given: S.
  - family: Bennett
    given: J. C.
  - family: Bliss
    given: Kathleen
  - family: Brunner
    given: Emil
  - family: Ellul
    given: Jacques
  - family: Niebuhr
    given: Reinhold
  - family: Oldham
    given: J. H.
  - family: Patijn
    given: C. L.
  - family: Thomas
    given: M. M.
  - family: Urwin
    given: E. C.
  event-place: London
  id: oldham_responsible_1948
  issued: 1948
  language: en-GB
  page: 120-154
  publisher: SCM Press
  publisher-place: London
  title: A responsible society
  title-short: Responsible society
  type: chapter
---

[@latourette_community_1938, 15]
[@oldham_responsible_1948, 123-124]
[@barbour_justice_1979, 281]

Style:

<?xml version="1.0" encoding="utf-8"?>
<style class="note" version="1.0" xmlns="http://purl.org/net/xbiblio/csl">  
  <citation>
    <layout>
      <group delimiter=" " font-style="normal">
        <label variable="page" form="short" plural="contextual"/>
        <text variable="page"/>
      </group>
      <group>
       <label prefix=", at " suffix=" " variable="locator" plural="contextual" form="short"/>
       <text variable="locator"/>
      </group>
    </layout>
  </citation>
  <bibliography>
    <layout suffix=".">
      <text variable="title"/>
    </layout>
  </bibliography>
</style>

Command line:

pandoc test.md -o test.html -s --citeproc --csl=style.csl
jgm commented 2 years ago

Thanks - fixed now in master.

denismaier commented 2 years ago

Thanks!

JohnCWood commented 2 years ago

Thank you!

denismaier commented 2 years ago

@jgm I'm trying to understand why that fixes the issue. Could you give me hint?

jgm commented 2 years ago

For some reason, there was a special case in the code for "page" -- I think this was based on a misunderstanding. This special case caused the label for "page" to be determined based on the locator rather than the page variable itself.

denismaier commented 2 years ago

Thanks again!