class DocTemplate::Tags::SectionTag
Constants
- SECTION_REMOVE_RE
- STUDENT_RE
- TAG_NAME
- TEMPLATES
Attributes
opts[R]
section[R]
Public Instance Methods
optional?()
click to toggle source
# File lib/doc_template/tags/section_tag.rb, line 16 def optional? section.optional end
parse(node, opts = {})
click to toggle source
# 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
Private Instance Methods
general_params()
click to toggle source
# File lib/doc_template/tags/section_tag.rb, line 36 def general_params @general_params ||= { placeholder: placeholder_id, priority_description: priority_description(section), priority_icon: priority_icon(section), react_props: { activity: { title: section.title }, material_ids: @section.material_ids, color: @section[:use_color] }, section: section, section_icons: section_icons(section) } end
parse_content(node, template)
click to toggle source
# File lib/doc_template/tags/section_tag.rb, line 53 def parse_content(node, template) params = general_params.merge(content: content_until_break(node)) params[:metacog] = section.metacognition.original_content&.sub(SECTION_REMOVE_RE, '') if optional? parsed_template = parse_template(params, template) parse_nested parsed_template, opts end
section_icons(section)
click to toggle source
# File lib/doc_template/tags/section_tag.rb, line 60 def section_icons(section) return [] if section.icons.nil? section.icons.map { |icon| "#{ICON_PATH}/#{icon}.png" } end