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

Parsing of mastersthesis entries #60

Closed plessl closed 11 years ago

plessl commented 11 years ago

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]]}}
inukshuk commented 11 years ago

Thanks Christian! I had not seen the type attribute before – I changed the citeproc export to set the type attribute at the end instead of the beginning; by default mastersthesis is converted to thesis (you can change that in BibTeX::Entry::CSL_TYPES).

If there is a type field in the entry I'm saving that as 'bibtex-type' in the json export in case you need to access that somewhere.

Thanks for reporting!

inukshuk commented 11 years ago

Landed in 2.2.1

plessl commented 11 years ago

Thanks for the quick fix. This is a nice idea, maybe all bibtex fields that have no clear mapping could be exported as custom field in the JSON output.

I have a follow up question though: I'm using citeproc-ruby for rendering. I'm trying to get this this bibtex-type field rendered with <text variable="bibtex-type"/>, but it doesn't render. Is this suppose to work? Shall I open an issue at citeproc-ruby?