Class: DocTemplate::Tags::CalloutTag

Inherits:
TableTag show all
Defined in:
lib/doc_template/tags/callout_tag.rb

Constant Summary collapse

TAG_NAME =
'callout'
TEMPLATES =
{
  default: 'callout.html.erb',
  gdoc: 'gdoc/callout.html.erb'
}.freeze

Constants inherited from BaseTag

BaseTag::SOFT_RETURN_RE, BaseTag::UNICODE_SPACES_RE

Instance Attribute Summary

Attributes inherited from BaseTag

#anchor, #content

Instance Method Summary collapse

Methods inherited from TableTag

#parse

Methods inherited from BaseTag

#before_tag, #check_tag_soft_return, #content_until_break, #content_until_materials, #ela2?, #ela6?, #gdoc?, #include_break?, #include_break_for?, #materials, parse, #parse, #parse_nested, #parse_template, #placeholder, #placeholder_id, #render, #replace_tag, #tag_data, tag_with_html_regexp, #template_name, #template_path, template_path_for

Instance Method Details

#parse_table(table) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/doc_template/tags/callout_tag.rb', line 12

def parse_table(table)
  header, content = fetch_content(table)
  params = {
    content: content,
    header: header,
    subject: @opts[:metadata].resource_subject
  }
  new_content = parse_template params, template_name(@opts)

  @opts[:parent_node] = new_content
  parsed_content = parse_nested new_content, @opts

  # Place placeholder where it should be
  before_tag(previous_non_empty(table) || table)

  # returns the generated content to be stored as part
  @content = parsed_content
  table.remove
end