class DocTemplate::Tags::HeadingTag

Constants

TEMPLATE

Public Instance Methods

parse(node, opts = {}) click to toggle source
# File lib/doc_template/tags/heading_tag.rb, line 8
def parse(node, opts = {})
  # we have to collect all the next siblings until next stop-tag
  params = {
    content: parse_nested(content_until_break(node), opts),
    heading: "<h3>#{heading(opts[:value])}</h3>",
    tag: self.class::TAG_NAME
  }
  @content = parse_template params, TEMPLATE

  replace_tag node
  self
end

Private Instance Methods

heading(value) click to toggle source
# File lib/doc_template/tags/heading_tag.rb, line 27
def heading(value)
  value.include?("#{prefix}:") ? value : "#{prefix}: #{value}"
end
prefix() click to toggle source
# File lib/doc_template/tags/heading_tag.rb, line 23
def prefix
  self.class::TITLE_PREFIX
end