Class: JekyllGithubPlugin::Tag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- JekyllGithubPlugin::Tag
- Defined in:
- lib/jekyll-github-plugin/tag.rb
Instance Method Summary collapse
-
#initialize(tag_name, text, tokens) ⇒ Tag
constructor
A new instance of Tag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, text, tokens) ⇒ Tag
Returns a new instance of Tag.
7 8 9 10 11 12 13 14 15 |
# File 'lib/jekyll-github-plugin/tag.rb', line 7 def initialize(tag_name, text, tokens) super @repo = text.strip() @repoParts = @repo.split("/") @user = @repoParts[0] @repository = @repoParts[1] @userUrl = "https://github.com/#{@user}" @repoUrl = "https://github.com/#{@user}/#{@repository}" end |
Instance Method Details
#render(context) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll-github-plugin/tag.rb', line 17 def render(context) result = "<div class='github-box repo' data-repo='#{@repo}'>" result << " <div class='github-box-title'>" result << " <h3><a class='owner' href='#{@userUrl}'>#{@user}</a>/<a class='repo' href='#{@repoUrl}'>#{@repository}</a></h3>" result << " <div class='github-stats'><a class='watchers' href='#{@repoUrl}/watchers'>?</a><a class='forks' href='#{@repoUrl}/network/members'>?</a></div>" result << " </div>" result << " <div class='github-box-content'><p class='description'><span></span> — <a href='#{@repoUrl}#readme'>Read More</a></p><p class='link'></p></div>" result << " <div class='github-box-download'><p class='updated'>Latest commit to the <strong>master</strong> branch on <span></span></p><a class='download' href='#{@repoUrl}/zipball/master'>Download as zip</a></div>" result << "</div>" result end |