Class: Jekyll::ArchiveLink::Tag

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll/archive_link/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, link_text, tokens) ⇒ Tag

Returns a new instance of Tag.



10
11
12
13
# File 'lib/jekyll/archive_link/tag.rb', line 10

def initialize(tag_name, link_text, tokens)
  super
  @link_text = link_text
end

Instance Attribute Details

Returns the value of attribute link_text.



8
9
10
# File 'lib/jekyll/archive_link/tag.rb', line 8

def link_text
  @link_text
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/jekyll/archive_link/tag.rb', line 8

def url
  @url
end

Instance Method Details

#archive_urlObject



22
23
24
25
26
# File 'lib/jekyll/archive_link/tag.rb', line 22

def archive_url
  Jekyll::ArchiveLink.debug("archive_url: #{@url}")

  URL.new(url).latest_archive_url
end

#render(context) ⇒ Object



15
16
17
18
19
20
# File 'lib/jekyll/archive_link/tag.rb', line 15

def render(context)
  @url = super(context).to_s.strip
  Jekyll::ArchiveLink.debug("Render called: #{@url}")

  %[<a href="#{archive_url}">#{link_text}</a>]
end