Class: Jekyll::PortTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::PortTag
- Defined in:
- lib/jekyll-beastiepress/port_tag.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ PortTag
constructor
A new instance of PortTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ PortTag
Returns a new instance of PortTag.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jekyll-beastiepress/port_tag.rb', line 21 def initialize(tag_name, markup, tokens) if markup =~ /(\S+(?:\/\S+)?)(\s+((?:"|')([^"']+)(?:"|')))?(\s+((?:"|')([^"']+)(?:"|')))?/i @port = $1 @link = $4 @title = $7 if !@link @link = @port end if !@title @title = @link end end super end |
Instance Method Details
#render(context) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/jekyll-beastiepress/port_tag.rb', line 36 def render(context) output = super if @port port = "<a class='port' href='http://freshports.org/#{@port}' title='#{@title}'>#{@link}</a>" else "Error processing input, expected syntax: {% port category/portname ['link text'] ['title text'] %}" end end |