UPDATE 6/4/15: this post was previously a page but was removed when I reorganised the sidebar. Check out the rbib project on GitHub.
This page contains a couple of small Ruby utilities I’ve written.
BibTeX parser
A parser for BibTeX databases. Mostly intended for transforming the entries in some way, such as deleting unneeded keys. But it also works as a general purpose BibTeX interface.
Example: remove all the url
fields from a database:
BibTeX::Parser.parse('input.bib').map do |entry| entry.reject_fields [:url] end.save('stripped.bib')
Source code: git clone https://nickg@github.com/nickg/rbib.git
Released under the GPLv3.
Future:
- Documentation
- Gem installer
Hi,
Amazing, exactly what I need!
Is it possible to work with Strings instead of files? I guess yes. What do you think the best way would be.
Thanks.
December 19, 2008 @ 2:04 pm
There is a parse_string method… Sorry :)
BTW, you should consider putting your lib on github, some persons might be interested.
Cheers.
December 19, 2008 @ 2:15 pm
Some of my bibtex entries include a comma after the last field, before the brace. Your parser fails such cases.
Basically, you need another peek for a brace before e.add_field parse_field.
May 26, 2011 @ 1:30 pm
> Basically, you need another peek for a brace before e.add_field parse_field.
Thanks! I’ve fixed it.
June 7, 2011 @ 6:54 am