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