Class: Jekyll::JamComments::Tag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::JamComments::Tag
- Defined in:
- lib/jekyll_jam_comments.rb
Instance Attribute Summary collapse
-
#markup ⇒ Object
readonly
Returns the value of attribute markup.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #configuration ⇒ Object
-
#initialize(tag_name, path, tokens) ⇒ Tag
constructor
A new instance of Tag.
- #render(context) ⇒ Object
- #service ⇒ Object
Constructor Details
#initialize(tag_name, path, tokens) ⇒ Tag
Returns a new instance of Tag.
12 13 14 15 16 |
# File 'lib/jekyll_jam_comments.rb', line 12 def initialize(tag_name, path, tokens) super @path = path end |
Instance Attribute Details
#markup ⇒ Object (readonly)
Returns the value of attribute markup.
10 11 12 |
# File 'lib/jekyll_jam_comments.rb', line 10 def markup @markup end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/jekyll_jam_comments.rb', line 10 def path @path end |
Instance Method Details
#configuration ⇒ Object
40 41 42 |
# File 'lib/jekyll_jam_comments.rb', line 40 def configuration Jekyll.configuration({})["jam_comments"] end |
#render(context) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll_jam_comments.rb', line 18 def render(context) path = context["page"] && context["page"]["url"] markup = service.fetch(:path => path) " #{markup} <script> window.jcAlpine.start(); </script> " end |
#service ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/jekyll_jam_comments.rb', line 30 def service @service ||= Service.new( :domain => Jekyll::JamComments::Configuration.domain, :api_key => Jekyll::JamComments::Configuration.api_key, :base_url => Jekyll::JamComments::Configuration.base_url, :environment => Jekyll::JamComments::Configuration.environment, :copy => Jekyll::JamComments::Configuration.copy ) end |