module Neruda::OrgFileHtmlizer

This module holds HTML formatter methods for the {Neruda::OrgFile} class.

Private Instance Methods

author_to_html() click to toggle source

Format {Neruda::OrgFile#author} in a HTML `span` tag with a

specific class.

@return [String] the author HTML `span`

# File lib/neruda/org_file/htmlizer.rb, line 39
def author_to_html
  "<span class=\"author\">#{@author}</span>"
end
date_to_html(dateformat = :full) click to toggle source

Format {Neruda::OrgFile#date} as a HTML `time` tag.

@return [String] the HTML `time` tag

# File lib/neruda/org_file/htmlizer.rb, line 30
def date_to_html(dateformat = :full)
  return '<time></time>' if @date.nil?
  "<time datetime=\"#{@date.rfc3339}\">#{datestring(dateformat)}</time>"
end
keywords_to_html() click to toggle source

Format {Neruda::OrgFile#keywords} list in an HTML listing.

@return [String] the HTML keywords list

# File lib/neruda/org_file/htmlizer.rb, line 15
    def keywords_to_html
      domain = Neruda::Config.settings['domain']
      klist = @keywords.map do |k|
        <<~KEYWORDLINK
          <li class="keyword">
            <a href="#{domain}/tags/#{Neruda::OrgFile.slug(k)}.html">#{k}</a>
          </li>
        KEYWORDLINK
      end.join
      "<ul class=\"keywords-list\">#{klist}</ul>"
    end