class Jekyll::GitHubComments::Comments

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/jekyll-github-comments.rb, line 13
def initialize(tag_name, markup, tokens)
  super
end

Public Instance Methods

parse(tokens) click to toggle source
Calls superclass method
# File lib/jekyll-github-comments.rb, line 17
def parse(tokens)
  super
  @line = tokens[0].line_number
end
render(context) click to toggle source
Calls superclass method
# File lib/jekyll-github-comments.rb, line 22
def render(context)
  if context["subcomments"] then
    context["comments"] = super
  else
    context["subcomments"] = true
    context["comments"] = super
    context["subcomments"] = false
  end

  config = DEFAULTS.merge(context["site"]["github_comments"] || {})

  path = context["page"]["path"]
  line_no = @line + context["page"]["yamlsize"] + 2
  context["comment_url"] = 
    "https://github.com/#{ config["repo"] }/edit/#{ config["branch"] }/#{ path }#L#{ line_no }"
  
  partial = Jekyll::Tags::IncludeTag.parse("include", config["comments_template"], [], @options)

  context.stack do
    partial.render(context)
  end
end