Class: JekyllSupport::APage
- Inherits:
-
Object
- Object
- JekyllSupport::APage
- Defined in:
- lib/structure/a_page_enrichment.rb
Overview
Overrides definition from ‘jekyll_plugin_support`
Instance Method Summary collapse
-
#render_entry_details(pattern) ⇒ Object
Renders a section entry as a string Recognized tokens are looked up, otherwise they are incorporated into the output Currently spaces are the only valid delimiters; HTML tags should be tokenized even when not delimited by spaces.
- #render_outline_apage(pattern) ⇒ Object
Instance Method Details
#render_entry_details(pattern) ⇒ Object
Renders a section entry as a string Recognized tokens are looked up, otherwise they are incorporated into the output Currently spaces are the only valid delimiters; HTML tags should be tokenized even when not delimited by spaces
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/structure/a_page_enrichment.rb', line 18 def render_entry_details(pattern) result = '' fields = case pattern when String pattern.split when Array pattern else @logger.error { "Pattern is neither a String nor an Array (#{pattern})" } end fields.each do |field| if KNOWN_FIELDS.include? field if respond_to? field value = send field result += "#{value} " elsif data.key?(field.to_sym) || data.key?(field.to_s) value = data[field.to_sym] || data[field.to_s] result += "#{value} " else @logger.warn { "'#{field}' is a known field, but it was not present in apage with url '#{@url}'." } end else result += "#{field} " end end result end |
#render_outline_apage(pattern) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/structure/a_page_enrichment.rb', line 7 def render_outline_apage(pattern) <<~END_ENTRY <span>#{@last_modified.strftime('%Y-%m-%d')}</span> <span><a href='#{@url}'>#{render_entry_details pattern}</a>#{@draft}</span> END_ENTRY end |