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”)[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”)[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”)[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
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