# citeproc-js/ruby

**URL:** <https://discourse.citationstyles.org/t/citeproc-js-ruby/1044>\
**Category:** CSL Development\
**Created:** [November 6, 2011, 9:38pm UTC](https://discourse.citationstyles.org/t/citeproc-js-ruby/1044 "2011-11-06T21:38:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [November 6, 2011, 9:38pm UTC](https://discourse.citationstyles.org/t/citeproc-js-ruby/1044/1 "2011-11-06T21:38:07Z")

</div>

Dear all,

it’s still a ways to go, but I would like to report that my experiments with embedding citeproc-js into Ruby are finally beginning to look very promising. For example, look at this IRB session:

> require ‘citeproc/js’  
> require ‘bibtex’  
> p = CiteProc::Processor.new  
> =\> #\<CiteProc::Processor style=“chicago-author-date” locale=“en-US” items=[0]\>  
> p \<\< BibTeX.open(“[http://books.google.com/books/download/The\_real\_life\_of\_Sebastian\_Knight.bibtex?id=dATxBeWioaIC&output=bibtex](http://books.google.com/books/download/The_real_life_of_Sebastian_Knight.bibtex?id=dATxBeWioaIC&output=bibtex)”)[0].to\_citeproc  
> =\> #\<CiteProc::Processor style=“chicago-author-date” locale=“en-US” items=[1]\>  
> p \<\< BibTeX.open(“[http://books.google.com/books/download/Laughter\_in\_the\_Dark.bibtex?id=qF7mOBb9\_VAC&output=bibtex](http://books.google.com/books/download/Laughter_in_the_Dark.bibtex?id=qF7mOBb9_VAC&output=bibtex)”)[0].to\_citeproc  
> =\> #\<CiteProc::Processor style=“chicago-author-date” locale=“en-US” items=[2]\>  
> p \<\< BibTeX.open(“[http://books.google.com/books/download/Pale\_fire.bibtex?id=NOcaAQAAMAAJ&output=bibtex](http://books.google.com/books/download/Pale_fire.bibtex?id=NOcaAQAAMAAJ&output=bibtex)”)[0].to\_citeproc  
> =\> #\<CiteProc::Processor style=“chicago-author-date” locale=“en-US” items=[3]\>  
> p.items.keys  
> =\> [:nabokov2008real, :nabokov1989laughter, :nabokov1992pale]  
> p[:nabokov1992pale].author.to\_s  
> =\> “V. Nabokov”  
> p.append [{ id: ‘nabokov2008real’, locator: 19 }]  
> =\> [[0, “(Nabokov and Dirda 2008, 19)”]]  
> p.append [{ id: ‘nabokov2008real’, locator: 19 }, { id: ‘nabokov1989laughter’, locator: 23 }]  
> =\> [[0, “(V. V. Nabokov and Dirda 2008, 19)”], [1, “(V. V. Nabokov and Dirda 2008, 19; V. Nabokov 1989, 23)”]]  
> p.append [{ id: ‘nabokov1992pale’, locator: 3 }]  
> =\> [[0, “(V. V. Nabokov and Dirda 2008, 19)”], [1, “(V. V. Nabokov and Dirda 2008, 19; V. Nabokov 1989, 23)”], [2, “(V. Nabokov 1992, 3)”]]  
> p.bibliography  
> =\> #\<CiteProc::Bibliography @references=[3], @errors=[0]\>  
> puts p.bibliography.join

Nabokov, V. 1989. _Laughter in the Dark_. Vintage International. Vintage Books. http://books.google.com/books?id=qF7mOBb9\_VAC.

———. 1992. _Pale fire_. Everyman’s library. Everyman’s library. http://books.google.com/books?id=NOcaAQAAMAAJ.

Nabokov, V.V., and M. Dirda. 2008. _The real life of Sebastian Knight_. New Directions paperbook. New Directions. http://books.google.com/books?id=dATxBeWioaIC.

All cite processing in this example was done by citeproc-js running in trace monkey, embedded in the Ruby process. This is still very much work in progress, but if you’d like to play around with it you can install the ‘citeproc-js’ gem and keep your fingers crossed. I’m working in Ruby 1.9.2 right now – I’ve had this running in 1.8 and JRuby, too, but I’ll not make any promises about the current state.

Best,  
Sylvester
