class String
String
methods
Public Instance Methods
make_bib_arxiv(id)
click to toggle source
# File lib/extcite/methods_string.rb, line 14 def make_bib_arxiv(id) # prep xml xml = Oga.parse_xml(self) # author = xml.xpath('//author//name')[0].text.downcase.gsub(/\s|\./, '_') year = DateTime.strptime(xml.xpath('//updated')[0].text).year # make bib citation bib = BibTeX::Bibliography.new bib << BibTeX::Entry.new({ :bibtex_type => :article, :url => xml.xpath('//entry/id').text, :author => xml.xpath('//author//name').collect { |x| x.text }.join(' and '), :eprint => id, :title => xml.xpath('//entry//title').text, :year => year }) return bib.to_s end
write_bib(file)
click to toggle source
# File lib/extcite/methods_string.rb, line 6 def write_bib(file) File.open(file, 'a') do |f| f.puts self end end