Class: Jekyll::WebmentionIO::Templates
- Inherits:
-
Object
- Object
- Jekyll::WebmentionIO::Templates
- Defined in:
- lib/jekyll/templates.rb
Instance Attribute Summary collapse
-
#supported_templates ⇒ Object
readonly
Returns the value of attribute supported_templates.
Instance Method Summary collapse
- #html_templates ⇒ Object
-
#initialize(site) ⇒ Templates
constructor
A new instance of Templates.
- #template_contents(template) ⇒ Object
Constructor Details
#initialize(site) ⇒ Templates
Returns a new instance of Templates.
8 9 10 11 12 13 14 15 |
# File 'lib/jekyll/templates.rb', line 8 def initialize(site) @site = site @supported_templates = (WebmentionIO.types + %w(count webmentions)).freeze @template_file_cache = {} @template_content_cache = {} end |
Instance Attribute Details
#supported_templates ⇒ Object (readonly)
Returns the value of attribute supported_templates.
6 7 8 |
# File 'lib/jekyll/templates.rb', line 6 def supported_templates @supported_templates end |
Instance Method Details
#html_templates ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jekyll/templates.rb', line 25 def html_templates setting = WebmentionIO.config.html_proofer_ignore proofer = if [Config::HtmlProofer::ALL, Config::HtmlProofer::TEMPLATES].include?(setting) ' data-proofer-ignore' else '' end @html_templates ||= begin templates = +'' # unfrozen String supported_templates.each do |template| templates << "<template style=\"display:none\" id=\"webmention-#{template}\"#{proofer}>" templates << template_contents(template) templates << '</template>' end templates end end |
#template_contents(template) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/jekyll/templates.rb', line 17 def template_contents(template) template_file = template_file(template) @template_content_cache[template_file] ||= begin WebmentionIO.log 'info', "Template file: #{template_file}" File.read(template_file) end end |