Class: DocTemplate::Tags::BlockTag
- Defined in:
- lib/doc_template/tags/block_tag.rb
Direct Known Subclasses
ColumnsTag, CoreContentObjectivesTag, DialogueTag, InsetTag, LanguageArtsObjectivesTag, MultipleChoiceTag, SmpTag, VocabTag, WhitePlaceholderTag
Constant Summary collapse
- END_VALUE =
'end'
Constants inherited from BaseTag
DocTemplate::Tags::BaseTag::SOFT_RETURN_RE, DocTemplate::Tags::BaseTag::UNICODE_SPACES_RE
Instance Attribute Summary
Attributes inherited from BaseTag
Instance Method Summary collapse
-
#block_nodes(node) ⇒ Object
Collects all the nodes before the closing tag.
- #no_end_tag_for(node) ⇒ Object
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
#block_nodes(node) ⇒ Object
Collects all the nodes before the closing tag
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/doc_template/tags/block_tag.rb', line 17 def block_nodes(node) end_tag_found = false tag_node = node # we have to collect all nodes until the we find the end tag nodes = [].tap do |result| check_tag_soft_return(node) while (node = node.next_sibling) if node.content.match?(end_tag_re) end_tag_found = true check_tag_soft_return(node) node.remove break end node = yield(node) if block_given? result << node end end no_end_tag_for(tag_node) unless end_tag_found nodes end |
#no_end_tag_for(node) ⇒ Object
8 9 10 11 12 |
# File 'lib/doc_template/tags/block_tag.rb', line 8 def no_end_tag_for(node) msg = "No tag with END value for: #{self.class::TAG_NAME.upcase}<br>" \ "<em>#{node.parent.try(:inner_html)}</em>" raise Lcms::Engine::DocumentError, msg end |