Class: DocTemplate::Tags::PositionTag

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

Constant Summary collapse

TAG_NAME =
'position'
TEMPLATE =
'position.html.erb'

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



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/doc_template/tags/position_tag.rb', line 9

def parse_table(table)
  table.remove && return unless @opts[:parent_tags].try(:include?, Tags::MaterialsTag::TAG_NAME)

  params = {
    content: table.at_xpath('.//tr[2]/td').inner_html,
    position: @opts[:value].strip
  }

  content = parse_template params, TEMPLATE
  @content = parse_nested(content, @opts)
  replace_tag table
end