Sha256: 826b9b679b9e414d458bfa3071d8a1e0dff2e2ad87ab7b8e42e1e46364d6eafe

Contents?: true

Size: 764 Bytes

Versions: 33

Compression:

Stored size: 764 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::Markdown.new(Redcarpet::Render::HTML).render(content.join)

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
bibtex-ruby-4.0.4 examples/bib2html.rb
bibtex-ruby-4.0.3 examples/bib2html.rb
bibtex-ruby-4.0.2 examples/bib2html.rb
bibtex-ruby-4.0.1 examples/bib2html.rb
bibtex-ruby-4.0.0 examples/bib2html.rb
bibtex-ruby-3.1.6 examples/bib2html.rb
bibtex-ruby-3.1.5 examples/bib2html.rb
bibtex-ruby-3.1.4 examples/bib2html.rb
bibtex-ruby-3.1.3 examples/bib2html.rb
bibtex-ruby-3.1.2 examples/bib2html.rb
bibtex-ruby-3.1.1 examples/bib2html.rb
bibtex-ruby-3.1.0 examples/bib2html.rb
bibtex-ruby-3.0.1 examples/bib2html.rb
bibtex-ruby-3.0.0 examples/bib2html.rb
bibtex-ruby-2.3.4 examples/bib2html.rb
bibtex-ruby-2.3.3 examples/bib2html.rb
bibtex-ruby-2.3.2 examples/bib2html.rb
bibtex-ruby-2.3.1 examples/bib2html.rb
bibtex-ruby-2.3.0 examples/bib2html.rb
bibtex-ruby-2.2.2 examples/bib2html.rb