Class: Jekyll::CitePaperTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-planningwikiplugins.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, text, tokens) ⇒ CitePaperTag

Returns a new instance of CitePaperTag.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/jekyll-planningwikiplugins.rb', line 63

def initialize(tag_name, text, tokens)
    super

    if text.split(' ').length > 2
      @text = text.encode('UTF-8').split(' ')[0..-3].join(" ")
      @paper = text.encode('UTF-8').split(' ')[-2]
      @pageno = text.encode('UTF-8').split(' ')[-1]
    else 
      @text = text.encode('UTF-8').split(' ')[0]
      @paper = text.encode('UTF-8').split(' ')[1]
      @pageno = 1
    end
end

Instance Method Details

#render(context) ⇒ Object



77
78
79
# File 'lib/jekyll-planningwikiplugins.rb', line 77

def render(context)
    "<a href=\"/_citedpapers/#{@paper}.pdf#page=#{@pageno}\">#{@text}</a>"
end