Class: InsertProcessor
- Inherits:
-
Object
- Object
- InsertProcessor
- Includes:
- Thymeleaf::Processor
- Defined in:
- lib/thymeleaf/dialects/default/processors/insert.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods included from Thymeleaf::Processor
#evaluate_in_context, #load_template, #subprocess_node
Instance Method Details
#call(node: nil, attribute: nil, context: nil, **_) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/thymeleaf/dialects/default/processors/insert.rb', line 8 def call(node:nil, attribute:nil, context:nil, **_) attribute.unlink template, fragment = FragmentExpression.parse(context, attribute.value) node_subcontent = get_node_template(template, node, context) node.children.each {|child| child.unlink } if fragment.nil? # Avoid infinite loop when template is "this" and fragment is nil return nil if is_self_template? template else node_subcontent = get_fragment_node(fragment, context, node_subcontent) end unless node_subcontent.nil? node_subcontent.dup.parent = node end end |