Git Product home page Git Product logo

Comments (5)

inukshuk avatar inukshuk commented on September 27, 2024

Matt!

When you parse BibTeX entries the names will be parsed by default; since you are creating the names from a hash, though, this doesn't happen automatically. Observe (working with your exampe):

> bib.to_citeproc['author']
=> "Ruby, Sam and Thomas, Dave, and Hansson, David Heinemeier"
> bib.parse_names
> bib.to_citeproc['author']
=> [{"family"=>"Ruby", "given"=>"Sam"}, {"family"=>"Thomas", "given"=>"Dave"}, {"family"=>"Hansson", "given"=>"David Heinemeier"}]

Once you've parsed the names, the citeproc processor can work with the values:

> CiteProc.process bib.to_citeproc, :style => :mla
=> "Ruby, Sam, Dave Thomas, and David Heinemeier Hansson. Agile Web Development with Rails. 2009."
> CiteProc.process bib.to_citeproc, :style => :mla, :mode => :citation
=> ["(Ruby, Thomas & Hansson)"]

from bibtex-ruby.

inukshuk avatar inukshuk commented on September 27, 2024

We should probably have #to_citeproc enforce name parsing; I'll include that with 2.0.1 which we'll push in the next couple of days.

from bibtex-ruby.

amattsmith avatar amattsmith commented on September 27, 2024

Ah! That makes sense. Thanks for the quick reply.

from bibtex-ruby.

amattsmith avatar amattsmith commented on September 27, 2024

One more question: This works great in a 1.9.2 irb session, but when running in a 1.9.2 and rails 3.1 console I get the following error and I am not sure how to proceed. Any help will be appreciated. (This is directly after the call to parse_names)

SystemStackError: stack level too deep
from /Users/mattsmith/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/forwardable.rb:185

from bibtex-ruby.

inukshuk avatar inukshuk commented on September 27, 2024

Matt,

thanks for reporting this issue. It quite clearly happens somewhere in the racc parser; to reproduce you can run

BibTeX::NameParser.new.parse('Sebastian Melmoth')

or, indeed, any name, and it will fail. The parse method calls the lexical analysis (which works, as you can try to call #scan directly with the name) followed by racc's #do_parse – that's where the error occurs.

As for debugging, we will have to look at the Racc module that ships with Ruby; or try to get at it from the other direction and find out what modifications Rails makes that may cause the error.

In any case, that's something we must figure out, as it's not acceptable for the name parser not to work with rails. I'll open a separate issue for this, please report back your findings if you're debugging this further!

from bibtex-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.