# citeproc-rb gem

**URL:** <https://discourse.citationstyles.org/t/citeproc-rb-gem/486>\
**Category:** CSL Development\
**Created:** [June 30, 2008, 10:19pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486 "2008-06-30T22:19:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_Magee](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@Liam\_Magee](https://discourse.citationstyles.org/u/Liam_Magee)\
**Post date:** [June 30, 2008, 10:19pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/1 "2008-06-30T22:19:31Z")

</div>

I’ve registered and been approved for a citeproc-rb project on RubyForge.  
This is to host releases of the Ruby gem (the packaging standard for Ruby).  
Once citeproc-rb matures a little it should be possible to do:

gem install citeproc-rb

I’m hoping to have a very early version over the next week or so - I’ll  
announce any releases through this list.

Regards,

Liam.

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [June 30, 2008, 11:50pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/2 "2008-06-30T23:50:01Z")

</div>

Excellent!

Bruce

---

<div class="post-metadata">

**Author:** ![Steve\_Toub](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@Steve\_Toub](https://discourse.citationstyles.org/u/Steve_Toub)\
**Post date:** [July 1, 2008, 12:03am UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/3 "2008-07-01T00:03:52Z")

</div>

Bruce D’Arcus wrote:\> On Mon, Jun 30, 2008 at 6:19 PM, Liam Magee \<@Liam\_Magee\> wrote:

> > I’ve registered and been approved for a citeproc-rb project on RubyForge.  
> > This is to host releases of the Ruby gem (the packaging standard for Ruby).  
> > Once citeproc-rb matures a little it should be possible to do:
> > 
> > gem install citeproc-rb
> > 
> > I’m hoping to have a very early version over the next week or so - I’ll  
> > announce any releases through this list.
> 
> Excellent!

Agreed. Many thanks!  
–SET

---

<div class="post-metadata">

**Author:** ![Liam\_Magee](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@Liam\_Magee](https://discourse.citationstyles.org/u/Liam_Magee)\
**Post date:** [July 4, 2008, 1:30pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/4 "2008-07-04T13:30:33Z")

</div>

I’ve released a gem of citeproc-rb via RubyForge - not sure when or if it’ll  
turn up in the gem lists.

This is at best an early alpha release - it supports the core Zotero styles  
with the test data Bruce sent through. What is missing are a substantive set  
of test cases, and I think some refactoring of the input/output handling.  
I’m hoping to dedicate some time over the next few weeks to work on the test  
cases more systematically.

Regards,

Liam.

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [July 4, 2008, 1:57pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/5 "2008-07-04T13:57:31Z")

</div>

> I’ve released a gem of citeproc-rb via RubyForge - not sure when or if it’ll  
> turn up in the gem lists.

Works for me!

Now what? The README doesn’t seem to apply to the gem install.

> This is at best an early alpha release - it supports the core Zotero styles  
> with the test data Bruce sent through. What is missing are a substantive set  
> of test cases, and I think some refactoring of the input/output handling.  
> I’m hoping to dedicate some time over the next few weeks to work on the test  
> cases more systematically.

Sounds good.

Bruce

---

<div class="post-metadata">

**Author:** ![Liam\_Magee](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@Liam\_Magee](https://discourse.citationstyles.org/u/Liam_Magee)\
**Post date:** [July 4, 2008, 2:17pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/6 "2008-07-04T14:17:11Z")

</div>

You should hopefully be able to run the example, e.g:

ruby examples/citeproc\_driver.rb --input test/fixtures/csl\_test\_data.json  
–content-type json --csl data/styles/ama.csl

Or used as a library, something like:

require ‘citeproc’

csl = Citeproc::CslParser.new([file or URL])  
locale = Citeproc::CslParser.new([file or URL])  
input\_filter = CSL::CslInputFilter.new  
input\_filter.parse({some JSON citations})  
processor = Citeproc::CslProcessor.new  
formatter = Citeproc::XhtmlFormatter.new  
nodes = processor.process\_bibliography(input\_filter, csl.style,  
locale.style)  
results = formatter.format(nodes)  
puts results

But yes, more documentation and some simplification of the API is needed  
too…

Regards,

Liam.2008/7/4 Bruce D’Arcus \<@Bruce\_D\_Arcus1\>:

---

<div class="post-metadata">

**Author:** ![Andrea\_Rossato1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Andrea\_Rossato1](https://discourse.citationstyles.org/u/Andrea_Rossato1)\
**Post date:** [July 4, 2008, 5:15pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/7 "2008-07-04T17:15:44Z")

</div>

I’m not familiar with ruby and its package management, and I tried to  
install citeproc-rb using gem. When I run the examples as suggested in  
the README I get the same error I get when I try it from the svn repo:

./examples/…/lib/citeproc/csl\_parser.rb:25: undefined method `gem' for main:Object (NoMethodError) from ./examples/../lib/citeproc.rb:18:in`require’  
from ./examples/…/lib/citeproc.rb:18  
from examples/citeproc\_driver.rb:19:in `require’  
from examples/citeproc\_driver.rb:19

this is the output of gem query --local:

\*\*\* LOCAL GEMS \*\*\*

builder (2.0.0)  
Builders for MarkUp.

citeproc-rb (0.0.1)  
Citeproc-rb is a Ruby port of the .

sources (0.0.1)  
This package provides download sources for remote gem installation

Could you please give me a hint on what I’m doing wrong? Unfortunately  
I have no time to start digging into ruby right now.

TIA.

Andrea

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [July 4, 2008, 6:19pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/8 "2008-07-04T18:19:18Z")

</div>

It seems gems isn’t loaded, but the csl\_parser.rb file then requires  
the builder gem. I believe. If you add this it should work (it does  
for me):

require ‘rubygems’

Bruce

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [July 4, 2008, 6:22pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/9 "2008-07-04T18:22:01Z")

</div>

Note: I just checked in this change. Hope that’s OK Liam.

Bruce

---

<div class="post-metadata">

**Author:** ![Liam\_Magee](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@Liam\_Magee](https://discourse.citationstyles.org/u/Liam_Magee)\
**Post date:** [July 4, 2008, 11:35pm UTC](https://discourse.citationstyles.org/t/citeproc-rb-gem/486/10 "2008-07-04T23:35:18Z")

</div>

Ah, ok, I missed that, thanks.

Regards,

Liam.2008/7/5 Bruce D’Arcus \<@Bruce\_D\_Arcus1\>:
