jgm / pandoc-citeproc

Library and executable for using citeproc with pandoc
BSD 3-Clause "New" or "Revised" License
291 stars 61 forks source link

Small caps added to a citation not interpreted #67

Closed adunning closed 10 years ago

adunning commented 10 years ago

With citeproc-js, one can add small caps to a citation using <span style="font-variant:small-caps;"> or <sc>. This isn't, however, currently picked up by pandoc-citeproc.

Example entries:

  {
    "publisher": "Brepols", 
    "ISBN": "9782503533490", 
    "publisher-place": "Turnhout", 
    "language": "Latin", 
    "collection-title": "<span style=\"font-variant:small-caps;\">cccm</span>", 
    "call-number": "BQ310 .C9 v.227 IMSF", 
    "title": "Sacerdos ad altare", 
    "note": "Uniform title: Sacerdos ad altare\nPhysical description: lxx, 294 p. ; 25 cm\nSeries: (Corpus Christianorum. Continuatio Mediaevalis ; 227.)\nSubject, personal: Neckam, Alexander, 1157-1217\nSubject, title: Bible--Criticism, interpretation, etc.--Early works to 1800\nBibliography note: Includes bibliographical references (p. [xlvii]-lxx) and indexes\nLanguage: Text in Latin; introduction in English\nSeries: Corpus Christianorum. Continuatio Mediaevalis ; 227\nkey: 7329747", 
    "source": "toroprod.library.utoronto.ca Library Catalog", 
    "issued": {
      "date-parts": [
        [
          "2010"
        ]
      ]
    }, 
    "event-place": "Turnhout", 
    "collection-number": "227", 
    "author": [
      {
        "literal": "Alexander Neckam"
      }
    ], 
    "type": "book", 
    "id": "neckam:2010sacerdos", 
    "editor": [
      {
        "given": "Christopher J.", 
        "family": "McDonough"
      }
    ]
  }
  {
    "publisher": "Love and Wyman", 
    "publisher-place": "London", 
    "language": "en", 
    "collection-title": "Publications of the Pipe Roll Society", 
    "issued": {
      "date-parts": [
        [
          "1900"
        ]
      ]
    }, 
    "title": "Feet of Fines of the Tenth Year of the Reign of King Richard <sc>i</sc>, <sc>ad</sc> 1198 to <sc>ad</sc> 1199", 
    "number-of-pages": "292", 
    "source": "Google Books", 
    "event-place": "London", 
    "collection-number": "24", 
    "type": "book", 
    "id": "society:1900feet", 
    "editor": [
      {
        "literal": "Pipe Roll Society"
      }
    ]
  }
jgm commented 10 years ago

+++ Andrew Dunning [Aug 14 14 11:13 ]:

With citeproc-js, one can [1]add small caps to a citation using <span style="font-variant:small-caps;"> or . This isn't, however, currently picked up by pandoc-citeproc.

From looking ath the code, these should be handled by the current version. Can you give a specific command that you think fails, with example input and output?

adunning commented 10 years ago

The system is obviously parsing the tags in some way, the tags themselves do not appear in the output; with the examples provided, the expected text simply ends up being treated as a standard lowercase word without being rendered in small caps.

adunning commented 10 years ago

I see now that putting a plain <span style="font-variant:small-caps;"> command in YAML works fine, but using the same reference from JSON does not work; is it perhaps the escaping of the quotation marks that is causing the problem with the JSON bibliography?

Understanding more clearly now what you meant by 'a specific command', here is a more detailed example:

pandoc -s -F pandoc-citeproc -t plain << EOT

---
references:
- event-place: Binghampton, <sc>ny</sc>
  publisher-place: Binghampton, <sc>ny</sc>
  collection-number: '118'
  page: '143-159'
  ISBN: '0866981721'
  call-number: PR275 .R4 L58 1995
  first-reference-note-number: 1
  container-title: 'Literature and Religion in the Later Middle Ages: Philological
    Studies in Honor of Siegfried Wenzel'
  language: Latin
  author:
  - family: Goering
    given: Joseph
  source: toroprod.library.utoronto.ca Library Catalog
  id: goering:1995summa
  issued:
    date-parts:
    - - 1995
  title: The Summa *Qui bene presunt* and Its Author
  type: chapter
  collection-title: Medieval and Renaissance Texts and Studies
  publisher: Center for Medieval and Early Renaissance Studies
  editor:
  - family: Newhauser
    given: Richard G.
  - family: Alford
    given: John A.
...

@goering:1995summa

EOT

Expected Output

Goering (1995)

Goering, Joseph. 1995. ‘The Summa Qui bene presunt and Its Author’. In Literature and Religion in the Later Middle Ages: Philological Studies in Honor of Siegfried Wenzel, edited by Richard G. Newhauser and John A. Alford, 143–59. Medieval and Renaissance Texts and Studies 118. Binghampton, NY: Center for Medieval and Early Renaissance Studies.

Actual Output

Goering (1995)

Goering, Joseph. 1995. ‘The Summa Qui bene presunt and Its Author’. In Literature and Religion in the Later Middle Ages: Philological Studies in Honor of Siegfried Wenzel, edited by Richard G. Newhauser and John A. Alford, 143–59. Medieval and Renaissance Texts and Studies 118. Binghampton, ny: Center for Medieval and Early Renaissance Studies.

adunning commented 10 years ago

Here also is are test files for showing the issue in a JSON bibliography, using the following command:

$ pandoc sc-test.md -F pandoc-citeproc -o sc-test.txt -t plain

Expected Results

Rosemann (2007)

Rosemann, Philipp W. 2007. The Story of a Great Medieval Book: Peter Lombard’s Sentences. Peterborough, ON: Broadview Press.

Actual Output

Rosemann (2007)

Rosemann, Philipp W. 2007. The Story of a Great Medieval Book: Peter Lombard’s Sentences. Peterborough, on: Broadview Press.

For contrast, this works correctly:

pandoc -s -F pandoc-citeproc -t plain << EOT

---
references:
- event-place: Peterborough, <span style="font-variant:small-caps;">on</span>
  note: "Physical description: 248 p. : ill Subject, personal: Peter Lombard, Bishop
    of Paris, ca. 1100-1160. Sententiarum libri IV Subject, corporate: Catholic Church–Doctrines–Early
    works to 1800–Textbooks Bibliography note: Includes bibliographical references
    and index key: 6127223"
  publisher-place: Peterborough, <span style="font-variant:small-caps;">on</span>
  ISBN: '9781551117188'
  call-number: BX1749 .P4 R673 2007
  title-short: The Story of a Great Medieval Book
  first-reference-note-number: 1
  author:
  - family: Rosemann
    given: Philipp W.
  source: toroprod.library.utoronto.ca Library Catalog
  id: rosemann:2007story
  issued:
    date-parts:
    - - 2007
  title: "The Story of a Great Medieval Book: Peter Lombard’s Sentences"
  type: book
  publisher: Broadview Press
...

@rosemann:2007story

EOT
jgm commented 10 years ago

Thanks for this better test case. I can see that the native output being produced is

RawInline (Format "html") "<sc>",Str "ny",RawInline (Format "html") "</sc>"

which comes across fine in HTML, but not, of course, in plain output.

I can't recall why I did it this way, with the raw HTML tags, rather than by using a pandoc SmallCaps element, which would work correctly in all output formats. I'll look into this; unless there's something I'm forgetting, using a SmallCaps seems a better solution.

jgm commented 10 years ago

Oh, I see, the sc tags are in your original.