inukshuk / bibtex-ruby Goto Github PK
View Code? Open in Web Editor NEWA BibTeX library, parser, and converter for Ruby.
Home Page: http://inukshuk.github.com/bibtex-ruby
License: GNU General Public License v3.0
A BibTeX library, parser, and converter for Ruby.
Home Page: http://inukshuk.github.com/bibtex-ruby
License: GNU General Public License v3.0
The following entry
@article{gürkan1999sample,
title={Sample-path solution of stochastic variational inequalities},
author={G{\"u}rkan, G. and Yonca {\"O}zge, A. and Robinson, S.M.},
journal={Mathematical Programming},
volume={84},
number={2},
pages={313--333},
year={1999},
publisher={Springer}
}
cannot be parsed by BibTeX, it gives
ERROR -- : Failed to parse BibTeX Name on value "," (COMMA) [["G{\\\"u}rkan, G."], " and ", "Yonca", "{\\\"O}zge"]
The following all work
author={G{\"u}rkan, G. and {\"O}zge, A. and Robinson, S.M.},
author={G{\"u}rkan, G. and Yonca, A. and Robinson, S.M.},
author={G{\"u}rkan, G. and Yonca Ozge, A. and Robinson, S.M.},
and the parsing works.
bibtex-ruby seems to have an issue with the latest nightlies of MacRuby. The following test program:
require 'rubygems'
require 'bibtex'
bib = BibTeX.open('./test2.bib')
puts bib.entries.size
Runs just fine under MRI, and ran just fine under earlier versions of post-0.8 MacRuby, but under the latest MacRuby nightlies, I get the following runtime error:
bibtex-ruby-1.2.0/lib/bibtex/extensions.rb:28:in `block': uninitialized constant Array::StringReplacement (NameError)
The full stack trace is shown in this gist:
https://gist.github.com/844817
Note that a) test2.bib is a minimal file containing only one entry, and b) that bibtex-ruby seems to take an awfully long time to crash under MacRuby.
Actually, in general, bibtex-ruby's performance under MacRuby is orders of magnitude worse than under MRI, but I don't know if that's anything you have control over- it's probably got more to do with RACC under MacRuby than anything else.
I am not very familiar with BibTeX.
But I noticed that Microsoft Academic Search provided a BibTeX export. Then I wondered if there were a BibTeX ruby gem, and found this one. Then I tried using it to parse an example BibTeX provided by MS Academic -- and it errored.
Is MS Academic providing bad BibTex, or is this a bug?
require 'bibtex'
BibTeX.parse <<-END
@article{
author = {Lucy T. Gunawan and Hani Alers and Willem-Paul Brinkman and Mark A. Neerincx},
title = {{Distributed collaborative situation-map making for disaster response}},
journal = {Interacting with Computers},
volume = {23},
year = {2011},
issue = {4},
doi = {DOI: 10.1016/j.intcom.2011.04.003},
masid = {39363847}
}
END
BibTeX::ParseError: Failed to parse BibTeX on value "=" (EQ) ["@", "article", "{", "author"]
from bibtex.y:121:in `on_error'
from (eval):3:in `_racc_do_parse_c'
from (eval):3:in `do_parse'
from bibtex.y:104:in `parse'
from /Users/jrochkind/.rvm/gems/ruby-1.9.3-p194/gems/bibtex-ruby-2.0.10/lib/bibtex/bibliography.rb:69:in `parse'
from /Users/jrochkind/.rvm/gems/ruby-1.9.3-p194/gems/bibtex-ruby-2.0.10/lib/bibtex/utilities.rb:36:in `parse'
The name bibtex is still unused on rubygems. I mean the ruby suffix is redundant, isn't it?
The parser cannot parse entry keys/ids starting with a number. For example as described in this test case.
Not sure if this goes under bibtex or citeproc, but when I export the following entry
Author = {Akkerman, S. and {Van den Bossche}, P. and Admiraal, W. and Gijselaers, W. and Segers, M. and Simons, R.J. and Kirschner, P.},
and use this line to render a full citations
citation = CiteProc.process(item.to_citeproc, :style => :apa)
the result is
Akkerman, S., {Van den Bossche}P., Admiraal, W., Gijselaers, W., Segers, M., Simons, R. J., & Kirschner, P. (2007). Reconsidering group cognition: From conceptual confusion to a boundary area between cognitive and socio-cultural perspectives?. Educational research review. Elsevier.
Now, I can of course easily remove the {} braces with a regexp, however there is also no comma and space rendered between the last name, and the P.
I am happy to modify the way to store these complex names in the bibtex file - I did try different permutations, such as putting P. {Van den Bossche} in the file, instead of {Van den Bossche}, P., but that did not help. If I put the name without braces, it only uses the last word as the last name.
Stian
Hello-
bibtex-ruby does not appear to be compatible with MacRuby- the gem installs ok, but trying to use it gives the following error message:
ERROR -- : Failed to parse BibTeX on value "$end" ($end) ["@", "article"]
Under MRI, bibtex-ruby parses the same file perfectly. Any ideas?
My bibliography contains a couple of entries from author with dutch names which have a "Van den" prefix. bibtex-ruby fails parsing these names, if "Van den" starts with an uppercase Van. Below is a test case that shows this problem.
Beware: I believe that it should be permitted to use an uppercase "Van" for such names in BibTeX, but I'm not completely sure about it. It is difficult to find an authoritative source on what is legal BibTeX and what not.
Cheers,
Christian
#!/usr/bin/env ruby
require 'mini_shoulda'
require 'minitest/autorun'
require 'bibtex'
class VanDenTest < MiniTest::Spec
context "parse a number of entries having a 'van' or 'van den' name prefix" do
setup do
@a = BibTeX.parse <<-END
@inproceedings{bout93,
Author = {van den Bout, D. E.},
Title = {The {Anyboard}: Programming and Enhancements},
Booktitle = {Proc. 1st IEEE Workshop on FPGAs for Custom Computing Machines (FCCM)},
Year = {1993},
Pages = {68--77}
}
END
@b = BibTeX.parse <<-END
@inproceedings{bout93,
Author = {Van den Bout, D. E.},
Title = {The {Anyboard}: Programming and Enhancements},
Booktitle = {Proc. 1st IEEE Workshop on FPGAs for Custom Computing Machines (FCCM)},
Year = {1993},
Pages = {68--77}
}
END
end
should "parse 'van den' part starting with lowercase letter" do
assert_equal(@a[:bout93].author[0].to_str, "van den Bout, D. E.")
assert_equal(@a[:bout93].author[0].prefix, "van den")
end
should "parse 'Van den' part starting with uppercase letter" do
assert_equal(@b[:bout93].author[0].to_str, "van den Bout, D. E.")
assert_equal(@b[:bout93].author[0].prefix, "Van den")
end
end
end
Use Ragel instead of racc for performance and better compatibility?
Currently, the lexer analyses the entire file, before the parser begins work. Although this is negligible for small bibliographies it may be annoying, especially if there is a semantic error at the start of the bibliography. For that reason, the lexical analysis and parsing should be done in a single-pass.
I'm trying to use the bibtex-ruby and citeproc-ruby libraries together and I am running into an issue. I wasn't sure if this should be filed under bibtex-ruby or citeproc-ruby. The citeproc format generated from bibtex-ruby is unable to be processed by citeproc-ruby. I've tried different ways, but get this error:
"undefined method `map' for Sam and Thomas Ruby:CiteProc::Name"
I'm creating a new BibTex::Entry from a hash similar to the example in the readme and then trying to process it to generate a citation. It doesn't seem to like the :author format. See below for irb session:
Loading development environment (Rails 3.1.0)
ruby-1.9.2-p290 :001 > require 'bibtex' => true
ruby-1.9.2-p290 :002 > require 'citeproc'
=> true
ruby-1.9.2-p290 :003 > bib = BibTeX::Entry.new({:type => :book, :key => :rails, :author => 'Ruby, Sam and Thomas, Dave, and Hansson, David Heinemeier', :title => 'Agile Web Development with Rails', :year => '2009'})
=> #<BibTeX::Entry author = Ruby, Sam and Thomas, Dave, and Hansson, David Heinemeier, title = Agile Web Development with Rails, year = 2009>
ruby-1.9.2-p290 :004 > bib.to_citeproc => {"id"=>"rails", "type"=>"book", "author"=>"Ruby, Sam and Thomas, Dave, and Hansson, David Heinemeier", "title"=>"Agile Web Development with Rails", "issued"=>{"date-parts"=>[[2009]]}}
ruby-1.9.2-p290 :005 > CiteProc.process(bib.to_citeproc, :style => :mla, :mode => :citation)ERROR CiteProc : failed to process item {"id"=>rails, "type"=>book, "author"=>Sam and Thomas Ruby, "title"=>Agile Web Development with Rails, "issued"=>{"date-parts"=>[[2009]], "literal"=>nil}}: undefined method `map' for Sam and Thomas Ruby:CiteProc::Name
=> [""]
Any ideas?
Thanks,
Matt
At the moment, bibtex-ruby returns multiline strings as-is, i.e. as a string with newline characters. This is probably not what most people would expect, and I can imagine no use cases where this behaviour would be desired. Therefore bibtex-ruby should in my opinion join multiple lines together and create a single line.
Example:
require 'bibtex'
BIB = <<END
@article{stuff,
title = "This very long title must be wrapped and continues
on the next line. bibtex-ruby should probably
join everything together and create a single line though."
}
END
bib = BibTeX.parse(BIB)
title = bib['stuff']['title']
puts title
puts
puts title.gsub(/\n+\s*/m, ' ')
Output:
This very long title must be wrapped and continues
on the next line. bibtex-ruby should probably
join everything together and create a single line though.
This very long title must be wrapped and continues on the next line. bibtex-ruby should probably join everything together and create a single line though.
By the way, I forgot to say thanks for this awesome library in the previous issue so let's do it now. My own little project would have been completely impossible without it.
Do you support biblatex entries like "pagetotal" and "MvBook"?
Would be great to be able to convert my biblatex file to CSL JSON, and your tool seems the only one that can do this type of conversion so far.
The statements in bibtex.rb to load the debugger were commented out previous releases, they're enabled in 1.3.4:
require 'ruby-debug'
Debugger.start
Should be removed, also is the code on github the latest? I don't see the fixes and version string for 1.3.4 and the history file tops out at 1.3.2
It may be useful to support initialize Bibliographies from YAML or JSON (or XML); this may work already but it should be tested and supportyed by cucumber features.
When exporting the 'von' part of names, it may be useful to allow control over whether the 'von' part is exported as a dropping or non-dropping particle.
The name parser's #do_parse
method (inside the Racc module) fails in Rails. See the discussion at the end of issue #30 for details.
gem i bibtex-ruby reports:
file 'Documentation"' not found
There are many error reports, because the ghost method readers raise undefined method errors: to make this a little bit less misleading, we should consider adding readers for all the default BibTeX fields permanently.
I'm having troubles parsing BibTeX files which use @string definitions. I have extracted a test case that shows the problem (see below).
When running this test case, I get the following output:
W, [2011-06-08 21:43:39#8608] WARN -- : Lexer: unexpected token `(' on line 0; brace level 2; mode :string.
W, [2011-06-08 21:43:39#8608] WARN -- : Lexer: unexpected token `)' on line 0; brace level 0; mode :entry.
W, [2011-06-08 21:43:39#8608] WARN -- : Lexer: unbalanced braces on line 0; brace level 0; mode :bibtex.
On the Future of Conferences
c-silly
Do you have any idea what is going wrong?
Cheers,
Christian
#!/usr/bin/env ruby
require 'bibtex'
b = BibTeX.parse <<-END
@string{c-silly = {Proc. Int. Conf. on Silly Conferences (SillyConf)}}
@inproceedings{mypublication,
Author = {John Doe and Rob Smith},
Title = {On the Future of Conferences},
Booktitle = c-silly,
Year = {2010},
Pages = {300--307},
Publisher = {Silly Publishers},
Month = dec
}
END
b.each do |obj|
obj.replace(b.q('@string'))
end
puts "#{b[:mypublication].title}"
puts "#{b[:mypublication].booktitle}"
The following line in my Ruby script
if item.respond_to? :keywords
where item comes from these two lines
b = BibTeX.open(Bibliography)
b.each do |item|
works for every single BibTex entry, except for one which uses Crossref to reference another publication. I tested this by removing the Crossref, and then it worked perfectly.
The "offending" entry is below:
@incollection{collins2006cognitive,
Author = {Collins, Allan},
Booktitle = {The Cambridge handbook of the learning sciences},
Crossref = {none2006cambridge},
Date-Added = {2011-07-25 15:13:38 +0000},
Date-Modified = {2011-11-25 03:54:53 +0000},
Read = {1},
Title = {Cognitive Apprenticeship},
Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUIJidUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLRBgdUcm9vdIABqAkKFRYXGyIjVSRudWxs0wsMDQ4RFFpOUy5vYmplY3RzV05TLmtleXNWJGNsYXNzog8QgASABqISE4ACgAOAB1lhbGlhc0RhdGFccmVsYXRpdmVQYXRo0hgNGRpXTlMuZGF0YU8RAZAAAAAAAZAAAgAAB1NTREhvbWUAAAAAAAAAAAAAAAAAAAAAAAAAAMl5T9hIKwAAANrWUhhjb2xsaW5zMjAwNmNvZ25pdGl2ZS5wZGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2sw2ylMAm1BERiAAAAAAAAIAAgAACSAAAAAAAAAAAAAAAAAAAAAHQmliZGVzawAAEAAIAADJeZYoAAAAEQAIAADKUzjbAAAAAQAMANrWUgAXPTEAAZ9eAAIAN1NTREhvbWU6VXNlcnM6AFN0aWFuOgBCaWJkZXNrOgBjb2xsaW5zMjAwNmNvZ25pdGl2ZS5wZGYAAA4AMgAYAGMAbwBsAGwAaQBuAHMAMgAwADAANgBjAG8AZwBuAGkAdABpAHYAZQAuAHAAZABmAA8AEAAHAFMAUwBEAEgAbwBtAGUAEgAsVXNlcnMvU3RpYW4vQmliZGVzay9jb2xsaW5zMjAwNmNvZ25pdGl2ZS5wZGYAEwABLwAAFQACAAz//wAAgAXSHB0eH1gkY2xhc3Nlc1okY2xhc3NuYW1lox8gIV1OU011dGFibGVEYXRhVk5TRGF0YVhOU09iamVjdF8QJi4uLy4uL0JpYmRlc2svY29sbGluczIwMDZjb2duaXRpdmUucGRm0hwdJCWiJSFcTlNEaWN0aW9uYXJ5EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIACAARABYAHwAoADIANQA6ADwARQBLAFIAXQBlAGwAbwBxAHMAdgB4AHoAfACGAJMAmACgAjQCNgI7AkQCTwJTAmECaAJxApoCnwKiAq8CtAAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAAAAAAAALG}}
(Generated by BibDesk).
Stian
Update Website (or remove it).
Hi Sylvester
When using bibtex-ruby to parse the the BibTeX record for my diploma thesis (see below) and exporting it to citeproc afterwards, I noticed that the entry is not of type "thesis" but "Diploma thesis". This prevents me to format the record with CSL afterwards, since only "thesis" is a default type in CSL.
I don't know what is the best way to represent BibTeX's "type" field for @mastersthesis records (which allows to differentiate between different Master's-thesis-like theses).
If there is no appropriate variable, I think it would be preferable to just export the entry as regular "thesis" in CSL.
What do you think?
Cheers,
Christian
@mastersthesis{plessl01_diplomathesis,
Author = {Plessl, Christian},
Title = {Reconfigurable Accelerators for Minimum Covering},
School = {ETH Zurich, Switzerland},
Year = {2001},
Address = {Computer Engineering and Networks Lab},
Month = mar,
Type = {Diploma thesis}
}
is parsed to
{"id"=>"plessl01_diplomathesis", "type"=>"Diploma thesis", "author"=>[{"family"=>"Plessl", "given"=>"Christian"}], "title"=>"Reconfigurable Accelerators for Minimum Covering", "school"=>"ETH Zurich, Switzerland", "publisher-place"=>"Computer Engineering and Networks Lab", "issued"=>{"date-parts"=>[[2001, 3]]}}
As soon as I add gem 'twitter-text'
to my Gemfile, the line
pub = BibTeX.parse(bibtex).convert(:latex)[0]
throws
uninitialized constant LaTeX::Unicode
Oo
I have only just come across this project so excuse me if I have missed something obvious. How do I remove braces from BibTeX entries? e.g., given a file nasa.bib containing
@Article{nasa,
author = {Neil Armstrong},
title = {I was a {NASA} astronaut},
journal = {Journal of {CAPITALISATION}},
year = 2011
}
the code
require 'bibtex'
require 'citeproc'
bib = BibTeX.open('nasa.bib')
CiteProc.process bib.to_citeproc, :style => 'apa'
gives
"Armstrong, N. (2011). I was a {NASA} astronaut. Journal of {CAPITALISATION}."
whereas I would have expected to see
"Armstrong, N. (2011). I was a NASA astronaut. Journal of CAPITALISATION."
which is what BibTeX gives me. I am not familiar with citeproc so I don't know if the problem is in bibtex-ruby or citeproc-ruby. Any help would be appreciated.
Before the commits made over the last day, I believed that the following two sequences of code should be equivalent, in the sense of having identical results for the state of thebibliography
.
First:
thebibliography = BibTeX.open(file, :filter => :latex)
Second:
thebibliography = BibTeX.open(file)
thebibliography.convert(:latex)
I believe that they were equivalent a day ago; but they are not equivalent now. For example:
$ irb
ruby-1.9.2-p290 :001 > require 'bibtex'
=> true
ruby-1.9.2-p290 :002 > b = BibTeX.open('./crossref.bib')
ruby-1.9.2-p290 :003 > b1 = BibTeX.open('./crossref.bib', :filter => :latex)
ruby-1.9.2-p290 :004 > b1 == b
=> true
ruby-1.9.2-p290 :005 > b.convert(:latex)
ruby-1.9.2-p290 :006 > b1 == b
=> false
ruby-1.9.2-p290 :007 > quit
$
The following line in my Ruby script
if item.respond_to? :keywords
where item comes from these two lines
b = BibTeX.open(Bibliography)
b.each do |item|
works for every single BibTex entry, except for one which uses Crossref to reference another publication. I tested this by removing the Crossref, and then it worked perfectly.
The "offending" entry is below:
@incollection{collins2006cognitive,
Author = {Collins, Allan},
Booktitle = {The Cambridge handbook of the learning sciences},
Crossref = {none2006cambridge},
Date-Added = {2011-07-25 15:13:38 +0000},
Date-Modified = {2011-11-25 03:54:53 +0000},
Read = {1},
Title = {Cognitive Apprenticeship},
Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUIJidUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLRBgdUcm9vdIABqAkKFRYXGyIjVSRudWxs0wsMDQ4RFFpOUy5vYmplY3RzV05TLmtleXNWJGNsYXNzog8QgASABqISE4ACgAOAB1lhbGlhc0RhdGFccmVsYXRpdmVQYXRo0hgNGRpXTlMuZGF0YU8RAZAAAAAAAZAAAgAAB1NTREhvbWUAAAAAAAAAAAAAAAAAAAAAAAAAAMl5T9hIKwAAANrWUhhjb2xsaW5zMjAwNmNvZ25pdGl2ZS5wZGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2sw2ylMAm1BERiAAAAAAAAIAAgAACSAAAAAAAAAAAAAAAAAAAAAHQmliZGVzawAAEAAIAADJeZYoAAAAEQAIAADKUzjbAAAAAQAMANrWUgAXPTEAAZ9eAAIAN1NTREhvbWU6VXNlcnM6AFN0aWFuOgBCaWJkZXNrOgBjb2xsaW5zMjAwNmNvZ25pdGl2ZS5wZGYAAA4AMgAYAGMAbwBsAGwAaQBuAHMAMgAwADAANgBjAG8AZwBuAGkAdABpAHYAZQAuAHAAZABmAA8AEAAHAFMAUwBEAEgAbwBtAGUAEgAsVXNlcnMvU3RpYW4vQmliZGVzay9jb2xsaW5zMjAwNmNvZ25pdGl2ZS5wZGYAEwABLwAAFQACAAz//wAAgAXSHB0eH1gkY2xhc3Nlc1okY2xhc3NuYW1lox8gIV1OU011dGFibGVEYXRhVk5TRGF0YVhOU09iamVjdF8QJi4uLy4uL0JpYmRlc2svY29sbGluczIwMDZjb2duaXRpdmUucGRm0hwdJCWiJSFcTlNEaWN0aW9uYXJ5EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIACAARABYAHwAoADIANQA6ADwARQBLAFIAXQBlAGwAbwBxAHMAdgB4AHoAfACGAJMAmACgAjQCNgI7AkQCTwJTAmECaAJxApoCnwKiAq8CtAAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAAAAAAAALG}}
(Generated by BibDesk).
Stian
When a certain string literal spans over multiple lines a lexer error is thrown. Unfortunately, many bibtex-entries contain long string literals, e.g., abstracts or many authors which often contain newlines.
test.bib:
@TechReport{ Rep,
author = "Donald
Duck"
}
BibTeX.open("test.bib")
W, [2011-06-22 12:29:40#5292] WARN -- : Lexer: unterminated string at 38; brace level 1; mode :literal.
I get this when I open a bibtex file:
Stian-Haklevs-MacBook-Pro:folders2web stian$ ruby skim.rb
names.y:173:in scan_literal': undefined method
scan_braced_expression' for #BibTeX::NameParser:0x0000010423e6f0 (NoMethodError)
from names.y:139:in do_scan' from names.y:108:in
scan'
from names.y:91:in parse' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/names.rb:29:in
parse'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/value.rb:172:in to_name' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/entry.rb:269:in
block in parse_names'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/entry.rb:265:in each' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/entry.rb:265:in
parse_names'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:119:in block in parse_names' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:298:in
call'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:298:in block in query' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:300:in
select'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:300:in query' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:119:in
parse_names'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:59:in parse' from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/bibliography.rb:46:in
open'
from /usr/local/lib/ruby/gems/1.9.1/gems/bibtex-ruby-1.3.2/lib/bibtex/utilities.rb:27:in open' from /Volumes/Home/stian/src/folders2web/wiki-lib.rb:21:in
ensure_refpage'
from skim.rb:66:in `
'
All the line in wiki-lib.rb does, is open a Bibtex file. It might be something with this file, because it worked perfectly before, and I didn't change any of the code.
The bibliography file is here: http://dl.dropbox.com/u/1341682/Bibliography.bib
The parser log (BibTeX::Parser::Log
) seems not to be initialized correctly. When bibtex-ruby encounters an error in the bibliography file, it fails with a NameError
instead of f.ex. printing the parse errors it encountered to stdout.
Minimal example:
require 'bibtex'
BIB = <<END
@book{book1,
title = "Parse error because"
author = "comma missing between title and author"
}
END
# Must set the log explicitely:
BibTeX::Parser::Log = BibTeX.log
BibTeX::Bibliography.parse(BIB)
If I don't initialize BibTeX::Parser::Log
explicitely, the following exception is thrown:
bibtex.y:117:in `on_error': uninitialized constant BibTeX::Parser::Log (NameError)
from /usr/lib/ruby/1.9.1/racc/parser.rb:99:in `_racc_do_parse_c'
from /usr/lib/ruby/1.9.1/racc/parser.rb:99:in `do_parse'
from bibtex.y:104:in `parse'
from /var/lib/gems/1.9.1/gems/bibtex-ruby-2.0.3/lib/bibtex/bibliography.rb:69:in `parse'
from bstr.rb:10:in `<main>'
Hi,
I am working on a simple tool to synchronize BibTex files with a directory of papers (similar to Mendeley): https://github.com/minad/bibsync. I am trying to migrate from my very simple handrolled bibtex parser to your gem. However after installation an issue with the unicode gem occured.
require 'bibtex'
RuntimeError: Failed to load unicode normalizer: please gem install unicode (or active_support)
require 'unicode'
LoadError: cannot load such file -- unicode/unicode_native
However the installation of the unicode gem went fine. Then I have a few questions about your gem:
Using BIBO ontology. Preliminary implementation done; needs further work.
The Bibliography enumerator methods and queries should return new Bibliography instances so that they work like other Ruby enumerators and support method chaining. This will reduce performance slightly and it may be a good idea to retain variations which return arrays like the current implementation.
Hi Sylvester
For preventing bibtex to change the case of acronyms in titles, I enclose the acronyms in a pair of braces, i.e. '{' and '}'. An example is shown in the test case below.
This method ensures that bibtex can still convert the title to titlecase or lowercase, as demanded by the bibstyle, while ensuring that acronyms are left unchanged.
bibtex-ruby parses these entries with braced acronyms correctly, but also preserves the braces when exporting the entry to citeproc or yaml, which causes citeproc-ruby to print the braces too.
Wouldn't it be more appropriate to remove such braces when exporting to citeproc and yaml?
Cheers,
Christian
#!/usr/bin/env ruby
require 'rubygems'
require 'bibtex'
require 'citeproc'
b = BibTeX.parse <<-END
@article{plessl12_ijrc,
Author = {Mariusz Grad and Christian Plessl},
Title = {On the Feasibility and Limitations of Just-In-Time Instruction Set Extension for {FPGA}-based Reconfigurable Processors},
Journal = {Int. Journal of Reconfigurable Computing (IJRC)},
Year = {2012},
Publisher = {Hindawi Publishing Corp.},
Doi = {doi:10.1155/2012/418315}
}
END
puts b['plessl12_ijrc'].to_citeproc
puts b['plessl12_ijrc'].to_yaml
Many BibTeX::Entry
objects of type :inbook
, :incollection
, and :inproceedings
have empty fields that should be populated from their parents as determined by :crossref
. So it would be nice to have a method in BibTeX::Entry
to allow all fields undefined in one entry to be populated from those defined in another entry.
I am happy to have a go at implementing such a method myself, but I am a Ruby novice and suspect I wouldn't do a very good job. I also suspect something quite simple may be possible by employing the convert() methods, but I am not sure. Any thoughts?
A Configurable Entry Key Generator
BibTeX.open file, :filter => :latex
Applies the LaTeX filter after parsing; but
BibTeX.open file, :filter => [:latex]
raises an error.
This might no be an error - the BibTeX standard is obscure enough that this might be expected functionality, but this minimal BibTeX entry:
@Article{akkerman2007reconsidering,
Author = {Akkerman, S. and Van den Bossche, P. and Admiraal, W. and Gijselaers, W. and Segers, M. and Simons, R.J. and Kirschner, P.},
Journal = {Educational research review},
Year = {2007},
}
failed to parse, and showed up with none of the authors.
changing it to
Author = {Akkerman, S. and {Van den Bossche}, P. and Admiraal, W. and Gijselaers, W. and Segers, M. and Simons, R.J. and Kirschner, P.},
resolved the issue.
I have a BibTeX file which I believe is valid since it works with other programs. Each entry in the file has white space before the citation key, as in this example:
@InCollection{ brown:family:1997,
address = {Princeton},
title = {Family Strategies and Religious Practice: Baptism and the
Lord's Supper in Early New England},
booktitle = {Lived Religion in America: Toward a History of Practice},
shorttitle = {Family Strategies},
publisher = {Princeton University Press},
author = {Brown, Anne S. and Hall, David D.},
editor = {Hall, David D.},
year = {1997},
pages = {41--68},
crossref = {hall:lived:1997}
}
When load the file with bibtex-ruby
, I get this error message:
bibtex.y:129:in `missing_key': Failed to parse BibTeX entry: cite-key missing (BibTeX::ParseError)
from bibtex.y:72:in `_reduce_27'
from (eval):3:in `_racc_do_parse_c'
from (eval):3:in `do_parse'
from bibtex.y:111:in `parse'
from /Users/lmullen/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/bibtex-ruby-2.1.1/lib/bibtex/bibliography.rb:69:in `parse'
from /Users/lmullen/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/bibtex-ruby-2.1.1/lib/bibtex/bibliography.rb:52:in `open'
The message goes away and the file loads properly if I strip out all the white space before the key. Can this be changed so that the whitespace does not cause an error?
bibtext-ruby does not decode charakters like --
, \&
or {\"u}
. Is there a proposed way to access the data in human readable format?
Using convert(:latex)
on a bibliography currently has mixed success. In particular, the following LaTeX commands are not always correctly filtered:
I am puzzled by this, as for some of these commands, latex-decode
by itself appears to give the correct results. For example:
ruby-1.9.2-p290 :007 > LaTeX.decode "\\\"{e}"
=> "ë"
The following transcript gives an example that exhibits all of these problems (it involves one call to BibTeX.open
and then one call to BibTeX.convert
; a search for "" will show where the problems lie):
ruby-1.9.2-p290 :001 > require 'bibtex'
=> true
ruby-1.9.2-p290 :002 > b = BibTeX.open('./latex.bib')
=> @book{proust_1996,
address = {Paris},
author = {Proust, Jo\"{e}lle},
booktitle = {Perception et Intermodalit\'{e}: Approches Actuelles De La Question De Molyneux},
date-added = {2011-10-02 12:51:45 -0400},
date-modified = {2011-10-02 12:51:45 -0400},
editor = {Proust, Jo\"{e}lle},
keywords = {Perception; Molyneux's Problem},
publisher = {Presses Universitaires de France},
title = {Perception et Intermodalit\'{e}: Approches Actuelles De La Question De Molyneux},
year = {1996}
}
@incollection{bach-y-rita_1996,
abstract = {Paul Bach-y-Rita (chapter 20) discusses his work on tactile-vision substitution systems. This research suggests that it is possible to ``see'' by means of tactile sensations, if these sensations are appropriately embedded within a sensorimotor framework.},
author = {{Bach-y-Rita}, Paul},
crossref = {proust_1996},
date-added = {2011-10-02 12:51:26 -0400},
date-modified = {2011-10-02 12:51:26 -0400},
keywords = {Perception; Molyneux's Problem; Vision},
note = {Reprinted in translation in \textcite[pp. 497--514]{noe_2002}.},
pages = {81--100},
title = {Substitution Sensorielle et Qualia}
}
@article{noe_2008,
author = {No\"{e}, Alva},
date-added = {2011-10-02 12:44:40 -0400},
date-modified = {2011-10-02 12:44:40 -0400},
journal = {Philosophy and Phenomenological Research},
keywords = {Perception; Enactivism; Vision},
month = {may},
number = {3},
pages = {660--665},
title = {Pr\'{e}cis of \emph{Action in Perception}},
url = {http://dx.doi.org/10.1111/j.1933-1592.2008.00161.x},
volume = {76},
year = {2008}
}
@article{bermudez_2007,
author = {Berm\'{u}dez, Jos\'{e} Luis},
date-added = {2011-10-02 12:43:54 -0400},
date-modified = {2011-10-02 12:43:54 -0400},
journal = {Philosophical Perspectives},
keywords = {Nonconceptual Content; Mind; Perception},
month = {dec},
number = {1},
pages = {55--72},
title = {What is at Stake in the Debate on Nonconceptual Content?},
url = {http://dx.doi.org/10.1111/j.1520-8583.2007.00120.x},
volume = {21},
year = {2007}
}
@book{ellegard_1958,
address = {G\"{o}teborg},
author = {Elleg{\aa}rd, Alvar},
booktitle = {Darwin and the General Reader: The Reception of Darwin's Theory of Evolution in the British Periodical Press, 1859---1972},
date-added = {2011-10-02 12:41:36 -0400},
date-modified = {2011-10-02 12:42:40 -0400},
keywords = {Darwin; History of Biology; History of Science; Sociology of Science},
note = {Reprinted by University of Chicago Press.},
publisher = {G\"{o}teborg Universitets {\AA}rsskrift},
title = {Darwin and the General Reader: The Reception of Darwin's Theory of Evolution in the British Periodical Press, 1859--1972},
volume = {64},
year = {1958}
}
@article{haggqvist_2007,
abstract = {It is widely held that the meaning of certain types of terms, such as natural kind terms, is individuated externalistically, in terms of the individual's external environment. Recently a more radical thesis has emerged, a thesis we dub `a posteriori semantics.' The suggestion is that not only does a term's meaning depend on the external environment, but so does its semantics. One motivation for this is the aim to account for cases where a putative natural kind term fails to pick out a natural kind: The term may have a standard externalist semantics (if it picks out a natural kind) or a more descriptivist one (if it does not). Knowing which semantics applies will therefore require detailed empirical knowledge. This move has also been employed in cases where a singular term, such as a name, fails to have a reference. We argue that a posteriori semantics is inherently implausible, since the type of semantics common terms should be given ought not to be conditional on details of chemistry or physics. A number of difficulties for the position---`metaphysical,' epistemological, and methodological---are articulated. Finally, we suggest that a posteriori semantics misconstrues the way in which semantics is empirical.},
author = {H\"{a}ggqvist, S\"{o}ren and \"{A}sa Maria Wikforss},
date-added = {2011-10-02 12:41:11 -0400},
date-modified = {2011-10-02 12:41:11 -0400},
journal = {Erkenntnis},
keywords = {Externalism; Content; Mind},
month = {nov},
number = {3},
pages = {373--386},
title = {Externalism and A Posteriori Semantics},
url = {http://dx.doi.org/10.1007/s10670-007-9051-4},
volume = {67},
year = {2007}
}
@article{hajek_1996,
abstract = {According to finite frequentism, the probability of an attribute A in a finite reference class B is the relative frequency of actual occurrences of A within B. I present fifteen arguments against this position.},
author = {H\'{a}jek, Alan},
date-added = {2011-10-02 12:40:45 -0400},
date-modified = {2011-10-02 12:40:45 -0400},
journal = {Erkenntnis},
keywords = {Probability},
month = {nov},
number = {2-3},
pages = {209-227},
title = {``Mises redux''---Redux: Fifteen Arguments against Finite Frequentism},
volume = {45},
year = {1996}
}
@article{bergstrom_1970a,
author = {Bergstr\"{o}m, Ingvar},
date-added = {2011-10-02 12:39:58 -0400},
date-modified = {2011-10-02 12:39:58 -0400},
journal = {Oud Holland},
keywords = {Holland; 17C; History of Art},
number = {1-4},
pages = {143-157},
title = {De Gheyn as a \emph{Vanitas} Painter},
url = {http://dx.doi.org/10.1163/187501770X00112},
volume = {85},
year = {1970}
}
@incollection{bricmont_2001,
address = {Heidelberg},
author = {Bricmont, Jean and D\"{u}rr, Detlef and Galavotti, Maria C. and Ghirardi, Giancarlo and Petruccione, Francesco and Zangh\`{i}, Nino},
booktitle = {Chance in Physics: Foundations and Perspectives},
date-added = {2011-10-02 12:39:05 -0400},
date-modified = {2011-10-02 12:39:05 -0400},
editor = {Bricmont, Jean and D\"{u}rr, Detlef and Galavotti, Maria C. and Ghirardi, Giancarlo and Petruccione, Francesco and Zangh\`{i}, Nino},
keywords = {Philosophy of Science; Physics; Probability; Quantum Mechanics; Thermodynamics},
publisher = {Springer},
series = {Lecture Notes in Physics},
title = {Chance in Physics: Foundations and Perspectives},
year = {2001}
}
@article{bowler_1975,
author = {Bowler, Peter J.},
date-added = {2011-10-02 12:38:00 -0400},
date-modified = {2011-10-02 12:38:00 -0400},
journal = {Journal of the History of Ideas},
keywords = {History of Biology; History of Science},
month = {mar},
number = {1},
pages = {95--114},
title = {The Changing Meaning of ``Evolution''\,},
url = {http://dx.doi.org/10.2307/2709013},
volume = {36},
year = {1975}
}
@article{wood_1995,
author = {Wood, Christopher S.},
date-added = {2011-10-02 12:36:54 -0400},
date-modified = {2011-10-02 12:36:54 -0400},
issue = {October-December},
journal = {Word and Image},
keywords = {History of Art; Holland; 17C; Curiosity},
number = {4},
pages = {332-352},
title = {\,`Curious Pictures' and the Art of Description},
volume = {11},
year = {1995}
}
@article{worrall_2000a,
abstract = {Having been neglected or maligned for most of this century, Newton's method of 'deduction from the phenomena' has recently attracted renewed attention and support. John Norton, for example, has argued that this method has been applied with notable success in a variety of cases in the history of physics and that this explains why the massive underdetermination of theory by evidence, seemingly entailed by hypothetico-deductive methods, is invisible to working physicists. This paper, through a detailed analysis of Newton's deduction of one particular 'proposition' in optics 'from the phenomena', gives a clearer account than hitherto of the method - highlighting the fact that it is really one of deduction from the phenomena plus 'background knowledge'. It argues, that, although the method has certain heuristic virtues, examination of its putative accreditational strengths reveals a range of important problems that its defenders have yet adequately to address.
},
author = {Worrall, John},
date-added = {2011-10-02 12:36:13 -0400},
date-modified = {2011-10-02 12:36:13 -0400},
journal = {British Journal for the Philosophy of Science},
keywords = {Newton; Underdetermination; Confirmation; Induction; Scientific Method; Philosophy of Science},
month = {mar},
number = {1},
pages = {45--80},
title = {The Scope, Limits, and Distinctiveness of the Method of `Deduction from the Phenomena': Some Lessons from Newton's `Demonstrations' in Optics},
url = {http://dx.doi.org/10.1093/bjps/51.1.45},
volume = {51},
year = {2000}
}
ruby-1.9.2-p290 :004 > b.convert(:latex)
=> @book{proust_1996,
address = {Paris},
author = {Proust, Jo\"{e}lle},
booktitle = {Perception et Intermodalité: Approches Actuelles De La Question De Molyneux},
date-added = {2011-10-02 12:51:45 -0400},
date-modified = {2011-10-02 12:51:45 -0400},
editor = {Proust, Jo\"{e}lle},
keywords = {Perception; Molyneux's Problem},
publisher = {Presses Universitaires de France},
title = {Perception et Intermodalité: Approches Actuelles De La Question De Molyneux},
year = {1996}
}
@incollection{bach-y-rita_1996,
abstract = {Paul Bach-y-Rita (chapter 20) discusses his work on tactile-vision substitution systems. This research suggests that it is possible to ``see'' by means of tactile sensations, if these sensations are appropriately embedded within a sensorimotor framework.},
author = {{Bach-y-Rita}, Paul},
crossref = {proust_1996},
date-added = {2011-10-02 12:51:26 -0400},
date-modified = {2011-10-02 12:51:26 -0400},
keywords = {Perception; Molyneux's Problem; Vision},
note = {Reprinted in translation in \textcite[pp. 497–514]noe_2002.},
pages = {81–100},
title = {Substitution Sensorielle et Qualia}
}
@article{noe_2008,
author = {No\"{e}, Alva},
date-added = {2011-10-02 12:44:40 -0400},
date-modified = {2011-10-02 12:44:40 -0400},
journal = {Philosophy and Phenomenological Research},
keywords = {Perception; Enactivism; Vision},
month = {may},
number = {3},
pages = {660–665},
title = {Précis of \emphAction in Perception},
url = {http://dx.doi.org/10.1111/j.1933-1592.2008.00161.x},
volume = {76},
year = {2008}
}
@article{bermudez_2007,
author = {Berm\'{u}dez, Jos\'{e} Luis},
date-added = {2011-10-02 12:43:54 -0400},
date-modified = {2011-10-02 12:43:54 -0400},
journal = {Philosophical Perspectives},
keywords = {Nonconceptual Content; Mind; Perception},
month = {dec},
number = {1},
pages = {55–72},
title = {What is at Stake in the Debate on Nonconceptual Content?},
url = {http://dx.doi.org/10.1111/j.1520-8583.2007.00120.x},
volume = {21},
year = {2007}
}
@book{ellegard_1958,
address = {Göteborg},
author = {Elleg{\aa}rd, Alvar},
booktitle = {Darwin and the General Reader: The Reception of Darwin's Theory of Evolution in the British Periodical Press, 1859—1972},
date-added = {2011-10-02 12:41:36 -0400},
date-modified = {2011-10-02 12:42:40 -0400},
keywords = {Darwin; History of Biology; History of Science; Sociology of Science},
note = {Reprinted by University of Chicago Press.},
publisher = {Göteborg Universitets \AArsskrift},
title = {Darwin and the General Reader: The Reception of Darwin's Theory of Evolution in the British Periodical Press, 1859–1972},
volume = {64},
year = {1958}
}
@article{haggqvist_2007,
abstract = {It is widely held that the meaning of certain types of terms, such as natural kind terms, is individuated externalistically, in terms of the individual's external environment. Recently a more radical thesis has emerged, a thesis we dub `a posteriori semantics.' The suggestion is that not only does a term's meaning depend on the external environment, but so does its semantics. One motivation for this is the aim to account for cases where a putative natural kind term fails to pick out a natural kind: The term may have a standard externalist semantics (if it picks out a natural kind) or a more descriptivist one (if it does not). Knowing which semantics applies will therefore require detailed empirical knowledge. This move has also been employed in cases where a singular term, such as a name, fails to have a reference. We argue that a posteriori semantics is inherently implausible, since the type of semantics common terms should be given ought not to be conditional on details of chemistry or physics. A number of difficulties for the position—`metaphysical,' epistemological, and methodological—are articulated. Finally, we suggest that a posteriori semantics misconstrues the way in which semantics is empirical.},
author = {H\"{a}ggqvist, S\"{o}ren and \"{A}sa Maria Wikforss},
date-added = {2011-10-02 12:41:11 -0400},
date-modified = {2011-10-02 12:41:11 -0400},
journal = {Erkenntnis},
keywords = {Externalism; Content; Mind},
month = {nov},
number = {3},
pages = {373–386},
title = {Externalism and A Posteriori Semantics},
url = {http://dx.doi.org/10.1007/s10670-007-9051-4},
volume = {67},
year = {2007}
}
@article{hajek_1996,
abstract = {According to finite frequentism, the probability of an attribute A in a finite reference class B is the relative frequency of actual occurrences of A within B. I present fifteen arguments against this position.},
author = {H\'{a}jek, Alan},
date-added = {2011-10-02 12:40:45 -0400},
date-modified = {2011-10-02 12:40:45 -0400},
journal = {Erkenntnis},
keywords = {Probability},
month = {nov},
number = {2-3},
pages = {209-227},
title = {``Mises redux''—Redux: Fifteen Arguments against Finite Frequentism},
volume = {45},
year = {1996}
}
@article{bergstrom_1970a,
author = {Bergstr\"{o}m, Ingvar},
date-added = {2011-10-02 12:39:58 -0400},
date-modified = {2011-10-02 12:39:58 -0400},
journal = {Oud Holland},
keywords = {Holland; 17C; History of Art},
number = {1-4},
pages = {143-157},
title = {De Gheyn as a \emphVanitas Painter},
url = {http://dx.doi.org/10.1163/187501770X00112},
volume = {85},
year = {1970}
}
@incollection{bricmont_2001,
address = {Heidelberg},
author = {Bricmont, Jean and D\"{u}rr, Detlef and Galavotti, Maria C. and Ghirardi, Giancarlo and Petruccione, Francesco and Zangh\`{i}, Nino},
booktitle = {Chance in Physics: Foundations and Perspectives},
date-added = {2011-10-02 12:39:05 -0400},
date-modified = {2011-10-02 12:39:05 -0400},
editor = {Bricmont, Jean and D\"{u}rr, Detlef and Galavotti, Maria C. and Ghirardi, Giancarlo and Petruccione, Francesco and Zangh\`{i}, Nino},
keywords = {Philosophy of Science; Physics; Probability; Quantum Mechanics; Thermodynamics},
publisher = {Springer},
series = {Lecture Notes in Physics},
title = {Chance in Physics: Foundations and Perspectives},
year = {2001}
}
@article{bowler_1975,
author = {Bowler, Peter J.},
date-added = {2011-10-02 12:38:00 -0400},
date-modified = {2011-10-02 12:38:00 -0400},
journal = {Journal of the History of Ideas},
keywords = {History of Biology; History of Science},
month = {mar},
number = {1},
pages = {95–114},
title = {The Changing Meaning of ``Evolution''\,},
url = {http://dx.doi.org/10.2307/2709013},
volume = {36},
year = {1975}
}
@article{wood_1995,
author = {Wood, Christopher S.},
date-added = {2011-10-02 12:36:54 -0400},
date-modified = {2011-10-02 12:36:54 -0400},
issue = {October-December},
journal = {Word and Image},
keywords = {History of Art; Holland; 17C; Curiosity},
number = {4},
pages = {332-352},
title = {\,`Curious Pictures' and the Art of Description},
volume = {11},
year = {1995}
}
@article{worrall_2000a,
abstract = {Having been neglected or maligned for most of this century, Newton's method of 'deduction from the phenomena' has recently attracted renewed attention and support. John Norton, for example, has argued that this method has been applied with notable success in a variety of cases in the history of physics and that this explains why the massive underdetermination of theory by evidence, seemingly entailed by hypothetico-deductive methods, is invisible to working physicists. This paper, through a detailed analysis of Newton's deduction of one particular 'proposition' in optics 'from the phenomena', gives a clearer account than hitherto of the method - highlighting the fact that it is really one of deduction from the phenomena plus 'background knowledge'. It argues, that, although the method has certain heuristic virtues, examination of its putative accreditational strengths reveals a range of important problems that its defenders have yet adequately to address.
},
author = {Worrall, John},
date-added = {2011-10-02 12:36:13 -0400},
date-modified = {2011-10-02 12:36:13 -0400},
journal = {British Journal for the Philosophy of Science},
keywords = {Newton; Underdetermination; Confirmation; Induction; Scientific Method; Philosophy of Science},
month = {mar},
number = {1},
pages = {45–80},
title = {The Scope, Limits, and Distinctiveness of the Method of `Deduction from the Phenomena': Some Lessons from Newton's `Demonstrations' in Optics},
url = {http://dx.doi.org/10.1093/bjps/51.1.45},
volume = {51},
year = {2000}
}
ruby-1.9.2-p290 :005 >
To clean up json dependency issues.
I'm considering to add more export formats over the summer; candidates include BibTeXML or Endnote. Please add formats you would like to see included as comments to this issue.
This is a follow up to #60.
CSL has only a generic thesis
type, making it impossible to differentiate between different kinds of these, e.g., Master's, Bachelor's, Diploma, Magister, Habilitation ...).
After reading the most recent CSL specification version 1.0.1 that explains the use of standad variables in more detail (http://citationstyles.org/downloads/specification.html#appendix-iv-variables) I believe that this is the purpose of the genre
variable.
Thus I would recommend to populate it with "Master's thesis" for @mastersthesis
records, "PhD thesis" for @phdthesis
records by default. If the BibTeX explicitly specifies a type
property, I suggest to populate genre
with the contents of the BibTeX type
field.
What do you think? Shall I try to provide a patch?
There seems to be a huge difference in speed between MacRuby (v. 0.12) and Ruby (1.9.2). In this case, it is simply parsing a file with 67 publications (a small subset of my large publication file, used for testing). Ruby parses the file in 0.16 seconds, and MacRuby uses almost 25 seconds (100 times slower).
I'd be happy to help you debug this if you let me know what to do. I am thinking about switching to MacRuby in my project, so I am quite interested in improving this.
[macruby] time macruby bibtextest.rb
#<BibTeX::Bibliography data=[67]>
macruby bibtextest.rb 24.45s user 0.66s system 119% cpu 20.964 total
[macruby] time ruby bibtextest.rb
#<BibTeX::Bibliography data=[67]>
ruby bibtextest.rb 0.16s user 0.03s system 98% cpu 0.198 total
[macruby] macruby --version
MacRuby 0.12 (ruby 1.9.2) [universal-darwin10.0, x86_64]
[macruby] wc ../folders2web/bibliography-short.bib
725 3358 89338 ../folders2web/bibliography-short.bib
script:
require 'rubygems'
require 'bibtex'
b=BibTeX.open("../folders2web/bibliography-short.bib")
p b
Improve and update rdoc documentation.
CiteProc export should consider the 'month' field when exporting issued and similar date values.
BibTeX uses the field 'key' as an optional sort key for entries; bibtex-ruby uses that name for the citation-key. Therefore, we should rename key to cite-key or id which will unfortunately break backwards compatibility.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.