Sha256: 42f8fff8819f9dce9c56b44d54d0570f023c8c110f6156a8247efef62a8ffb47

Contents?: true

Size: 593 Bytes

Versions: 24

Compression:

Stored size: 593 Bytes

Contents

require 'bibmarkdown'
require 'bibtex'
require 'csl/styles'

# Sets the default directory of citation styles.
CSL::Style.root = File.dirname(__FILE__) + '/../citationstyles'

# Define a citation filter using bibmarkdown
Nanoc::Filter.define(:scholar_citation) do |content, params|
  bib = params[:bibfile]
  if not bib
    raise "Could not find bibliography file"
  end
  entries = BibTeX.parse(bib.raw_content).entries
  entries.each_value { |e| e.convert!(:latex) { |key| key != :url } }
  params = params.merge(entries: entries)
  BibMarkdown::Document.new(content, params).to_markdown
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
scholarmarkdown-3.2.1 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-3.2.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-3.1.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-3.0.1 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-3.0.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.11.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.10.1 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.10.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.9.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.8.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.7.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.6.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.5.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.4.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.3.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.2.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.1.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-2.0.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-1.4.0 lib/scholarmarkdown/filter/citation.rb
scholarmarkdown-1.3.1 lib/scholarmarkdown/filter/citation.rb