Class: JSC::JSCite
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- JSC::JSCite
- Includes:
- Plugin
- Defined in:
- lib/JSCite.rb
Instance Attribute Summary
Attributes included from Plugin
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ JSCite
constructor
A new instance of JSCite.
- #render(ctx) ⇒ Object
Methods included from Plugin
#config, #math_jax, #mj_config, #mj_local, #mj_local?, #mj_url, #set_ctx
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ JSCite
Returns a new instance of JSCite.
9 10 11 12 13 |
# File 'lib/JSCite.rb', line 9 def initialize(tag_name, markup, tokens) super @key = markup @config = Hash.new end |
Instance Method Details
#render(ctx) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/JSCite.rb', line 15 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 |