Sha256: 27ba55abd8f8eedd205e6b53ce3d154934b2e332dcc09a05601d865eafe7c2b4
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
require 'bibtex' require 'citeproc' require File.dirname(__FILE__) + '/plugin' module JSC class JSCite < Liquid::Tag include JSC::Plugin def initialize(tag_name, markup, tokens) super @key = markup @config = Hash.new end def render(ctx) set_ctx ctx ctx['jsc'] ||= {} ctx['jsc']['cited'] ||= [] ctx['jsc']['cited'] << key entry = bib[key.to_s.strip] if entry == nil missing_ref key else puts 'entry' puts entry puts 'citeproc' puts entry.to_citeproc puts 'key' puts entry.key citation = CiteProc.process entry.to_citeproc, :style => config['bibtex']['style'], :locale => config['bibtex']['locale'], :format => config['bibtex']['format'], :mode => :citation puts 'citation' puts citation link_to "##{[prefix, key].compact.join('-')}", citation.join end end end end Liquid::Template.register_tag('Xcite', JSC::JSCite)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jekyll-scientific-0.0.3 | lib/JSCite.rb |
jekyll-scientific-0.0.2 | lib/JSCite.rb |
jekyll-scientific-0.0.1 | lib/JSCite.rb |