Class: DocTemplate::Tags::SectionTag

Inherits:
BaseTag
  • Object
show all
Includes:
Helpers
Defined in:
lib/doc_template/tags/section_tag.rb

Constant Summary collapse

STUDENT_RE =
/^\s*student\s*resources\s*$/i.freeze
TAG_NAME =
'section'
SECTION_REMOVE_RE =
/\[#{TAG_NAME}:[^\]]*\]/i.freeze
TEMPLATES =
{
  default: 'section.html.erb',
  gdoc: 'gdoc/section.html.erb'
}.freeze

Constants included from Helpers

Helpers::ICON_PATH

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 included from Helpers

#materials_container, #priority_description, #priority_icon

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_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

#optional?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/doc_template/tags/section_tag.rb', line 16

def optional?
  section.optional
end

#parse(node, opts = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/doc_template/tags/section_tag.rb', line 20

def parse(node, opts = {})
  @opts = opts
  @section = opts[:agenda].level2_by_title(opts[:value].parameterize)
  @anchor = @section.anchor
  @materials = @section.material_ids

  @content = parse_content node, template_name(opts)

  replace_tag node
  self
end