1 package org.simantics.scl.compiler.markdown.nodes;
3 import org.simantics.scl.compiler.markdown.internal.ExtensionNodeHandler;
5 public class ExtensionBlockNode extends Node {
9 public ExtensionBlockNode(String extension, String content) {
10 this.extension = extension;
11 this.content = content;
15 public void processExtensionNodes(ExtensionNodeHandler handler) {
16 DocumentNode replacingNodes = handler.expandBlock(extension, content);
17 if(replacingNodes != null) {
18 if(replacingNodes.firstChild == null)
21 for(Node child = replacingNodes.firstChild; child != null; child = child.next)
22 child.parent = parent;
24 parent.firstChild = replacingNodes.firstChild;
26 replacingNodes.firstChild.prev = prev;
27 prev.next = replacingNodes.firstChild;
30 parent.lastChild = replacingNodes.lastChild;
32 replacingNodes.lastChild.next = next;
33 next.prev = replacingNodes.lastChild;
40 public void toHtml(StringBuilder b) {
41 b.append("::").append(extension).append('[').append(content).append(']');