Module: Relaton::Bib::Converter::Bibtex
- Defined in:
- lib/relaton/bib/converter/bibtex.rb,
lib/relaton/bib/converter/bibtex/to_bibtex.rb,
lib/relaton/bib/converter/bibtex/from_bibtex.rb
Defined Under Namespace
Classes: FromBibtex, ToBibtex
Class Method Summary collapse
-
.from_item(item, bibtex = nil) ⇒ Object
ItemData -> BibTeX::Bibliography.
-
.to_item(bibtex_str) ⇒ Object
BibTeX string -> HashString=>ItemData.
Class Method Details
.from_item(item, bibtex = nil) ⇒ Object
ItemData -> BibTeX::Bibliography
9 10 11 |
# File 'lib/relaton/bib/converter/bibtex.rb', line 9 def self.from_item(item, bibtex = nil) ToBibtex.new(item).transform(bibtex) end |
.to_item(bibtex_str) ⇒ Object
BibTeX string -> HashString=>ItemData
14 15 16 17 18 19 |
# File 'lib/relaton/bib/converter/bibtex.rb', line 14 def self.to_item(bibtex_str) BibTeX.parse(bibtex_str).reduce({}) do |h, bt| h[bt.key] = FromBibtex.new(bt).transform h end end |