inukshuk / citeproc-ruby

A Citation Style Language (CSL) Cite Processor
103 stars 23 forks source link

Render multiple citations #69

Closed mapreal19 closed 5 years ago

mapreal19 commented 5 years ago

Is it possible to render more than one citation at the same time? I saw there is an items property but not sure if implemented. I was looking for something like this:

cp.render :citation, items: [{ id: 'knuth' }, { id: 'knuth2' }] # output: (Knuth, 1968; Knuth2, 1968)

inukshuk commented 5 years ago

It's definitely implemented yes (some styles treat multi-cites very differently than, e.g., citing the same references in a row).

inukshuk commented 5 years ago

I'd have to check but I think you are supposed to pass a Citeproc::CitationData object to the render method. This can cover multiple items.

mapreal19 commented 5 years ago

ok realized how to do it:

`cp.render :citation, [{ id: 'knuth' }, { id: 'knuth2' }] # output: (Knuth, 1968; Knuth2, 1968)

Just passing the array directly works :)