Sha256: 0c6d7e00cf6044c1cbc8ad11393290611a16e6c210f649513e54e9b5065082dd

Contents?: true

Size: 730 Bytes

Versions: 18

Compression:

Stored size: 730 Bytes

Contents

require 'rubygems'
require 'bibtex'


# Open a bibliography file
bib = BibTeX.open File.expand_path('../markdown.bib',__FILE__),
  :include => [:meta_content]


# Replaces all strings in the Bibliography and then
# converts each BibTeX entries to a string using Chicago style
# (all other elements are mapped to simple strings)

begin
  require 'citeproc'
rescue LoadError
  puts 'this example depends on the citeproc-ruby gem'
  exit
end

content = bib.replace.q('@entry, @meta_content').map do |b|
  if b.entry?  
    CiteProc.process b.to_citeproc
  else
    b.to_s
  end
end


begin
  require 'redcarpet'
rescue LoadError
  puts 'this example depends on the redcarpet gem'
  exit
end

puts Redcarpet.new(content.join).to_html

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
bibtex-ruby-2.0.4 examples/bib2html.rb
bibtex-ruby-2.0.3 examples/bib2html.rb
bibtex-ruby-2.0.2 examples/bib2html.rb
bibtex-ruby-2.0.1 examples/bib2html.rb
bibtex-ruby-2.0.0 examples/bib2html.rb
bibtex-ruby-2.0.0pre1 examples/bib2html.rb
bibtex-ruby-1.3.12 examples/bib2html.rb
bibtex-ruby-1.3.11 examples/bib2html.rb
bibtex-ruby-1.3.10 examples/bib2html.rb
bibtex-ruby-1.3.9 examples/bib2html.rb
bibtex-ruby-1.3.8 examples/bib2html.rb
bibtex-ruby-1.3.7 examples/bib2html.rb
bibtex-ruby-1.3.6 examples/bib2html.rb
bibtex-ruby-1.3.5 examples/bib2html.rb
bibtex-ruby-1.3.4 examples/bib2html.rb
bibtex-ruby-1.3.3 examples/bib2html.rb
bibtex-ruby-1.3.2 examples/bib2html.rb
bibtex-ruby-1.3.1 examples/bib2html.rb