class JekyllGithubPlugin::Tag

Public Class Methods

new(tag_name, text, tokens) click to toggle source
Calls superclass method
# 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 = "http://github.com/#{@user}"
  @repoUrl = "http://github.com/#{@user}/#{@repository}"
end

Public Instance Methods

render(context) click to toggle source
# 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> &mdash; <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