seboettg / citeproc-php

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

Removing item number from rendered bibliography of a single item #104

Open cambraca opened 3 years ago

cambraca commented 3 years ago

Question:

Is there a way to get a single bibliography item without the number? E.g. for this example, I get the following HTML:

<div class="csl-bib-body">
  <div class="csl-entry"><div class="csl-left-margin">1.</div><div class="csl-right-inline">Home / Twitter. Twitter. Accessed June 21, 2021. https://twitter.com/home</div></div>
</div>

But I'd like the following (maybe even without the "csl-entry" div):

<div class="csl-entry"><div class="csl-right-inline">Home / Twitter. Twitter. Accessed June 21, 2021. https://twitter.com/home</div></div>

(Note that not all styles produce these numbers)

One option could be to parse the result as XML in PHP and remove the ".csl-left-margin" element, but I'm wondering if there's a cleaner and more "correct" way of doing this.

Used CSL stylesheet:

american-medical-association.csl

Used CSL metadata

[{
  "id": "item-1",
  "type": "webpage",
  "container-title": "Twitter",
  "language": "en",
  "title": "Home / Twitter",
  "URL": "https://twitter.com/home",
  "accessed": {
    "date-parts": [
      [2021", 6, 21]
    ]
  }
}]
seboettg commented 2 years ago

Hi @cambraca! For me, the question is what does the CSL specification intend in this case? Have you looked at this?

xopoc14 commented 1 year ago

@cambraca @seboettg It is not an issue of cite-proc. The number is a part of American Medical Association style specification. You can use a different CSL style which does not render a citation number or as a workaround hide it with css.

rbran100 commented 1 year ago

It would be helpful to render a single bibliographic item without the list format applied, for cases when it is not used in a list, but see the CSL rub. Any idea how to preprocess the csl on the way in to suppress this reliably?