Sha256: 56aa7e3d8b745381ad77c5b4db162b55b1cb3eea440d6087b3f12d800492e469
Contents?: true
Size: 924 Bytes
Versions: 27
Compression:
Stored size: 924 Bytes
Contents
require 'rubygems' require 'bibtex' begin require 'citeproc/ruby' require 'csl/styles' rescue LoadError puts 'this example depends on the citeproc-ruby and csl-styles gems' exit end # 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) bib.replace cp = CiteProc::Processor.new :style => 'apa', :format => 'html', :locale => 'en' cp.import bib.to_citeproc content = bib['@entry, @meta_content'].map do |e| if e.entry? cp.render :bibliography, :id => e.key else e.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
27 entries across 27 versions & 2 rubygems