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
<div class="csl-bib-body">
  <div class="csl-entry">Nabokov, V. 1989. <i>Laughter in the Dark</i>. Vintage 
International. Vintage Books. 
http://books.google.com/books?id=qF7mOBb9\_VAC.</div>

  <div class="csl-entry">———. 1992. <i>Pale fire</i>. Everyman’s library. 
Everyman’s library. http://books.google.com/books?id=NOcaAQAAMAAJ.</div>

  <div class="csl-entry">Nabokov, V.V., and M. Dirda. 2008. <i>The real life of 
Sebastian Knight</i>. New Directions paperbook. New Directions. 
http://books.google.com/books?id=dATxBeWioaIC.</div>
</div>

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




------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
xbiblio-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbiblio-devel

Reply via email to