Class: DocTemplate::Tables::Section
- Defined in:
- lib/doc_template/tables/section.rb
Constant Summary collapse
- FAKE_SECTION_TITLE =
'lesson'
- HEADER_LABEL =
'section-metadata'
- HTML_VALUE_FIELDS =
['section-summary'].freeze
- MATERIALS_KEY =
'section-materials'
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#collect_and_render_tags, #fetch_materials, #initialize, parse, #parse_in_context, #table_exist?
Constructor Details
This class inherits a constructor from DocTemplate::Tables::Base
Instance Method Details
#parse(fragment, *args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/doc_template/tables/section.rb', line 11 def parse(fragment, *args) section_tables = fragment.xpath(, XpathFunctions.new) # # Allows to handle ELA as Math:: inject fake section return fake_section(fragment) if section_tables.empty? && args.[:force_inject] [].tap do |result| section_tables.each do |el| table = el.ancestors('table').first data = fetch table value = data['section-title'].parameterize table.replace section_placeholder(value) data = fetch_materials data, MATERIALS_KEY result << data end end end |