inukshuk / citeproc-ruby

A Citation Style Language (CSL) Cite Processor
101 stars 22 forks source link

How to add a new output format? #66

Open retorquere opened 5 years ago

retorquere commented 5 years ago

I'm looking to create an output format that outputs ansi console codes -- any tips on where to start on creating a new output format?

inukshuk commented 5 years ago

You can see the current formats here. To create a new format you need to sub-class Format and override any of the methods here and add apply_* methods for any CSL formatting directive you wish to implement (e.g., apply_font_style, apply_vertical_align, etc.).

retorquere commented 5 years ago

Interesting -- I thought styles could apply stuff like bold and italics (I once created a markdown format inside Zotero) but I don't see any of it here. Maybe this isn't required though for my case and I could just stick to the plain format.

inukshuk commented 5 years ago

Yes, for those you need to implement apply_font_weight and apply_font_style. Take a look at the html format as an example: it maps those to CSS styles or uses <b>, <i> tags (that's an internal configuration option used by the format).