inukshuk / bibtex-ruby

A BibTeX library, parser, and converter for Ruby.
http://inukshuk.github.com/bibtex-ruby
GNU General Public License v3.0
156 stars 31 forks source link

Removing braces when exporting to citeproc or yaml #43

Closed plessl closed 12 years ago

plessl commented 12 years ago

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
inukshuk commented 12 years ago

Hi,

You can use the LaTeX filter to remove braces. If you want to strip braces only, keeping LaTeX directives, you'd have to write your own filter.

For more details, see #41

plessl commented 12 years ago

Great, that solves my problem. Thanks.