aboutsummaryrefslogtreecommitdiff
path: root/lib/html/index.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-10-13 22:10:42 +0100
committerMichael Williamson <mike@zwobble.org>2015-10-13 22:10:42 +0100
commitaac776b1711d1e286812035a28108c622e73994a (patch)
tree366673f18143771fabbadb0fcef86d638ce33f43 /lib/html/index.js
parent2fb7a36230b167aac99fe8d43959833bd3b244dd (diff)
Add simplification of nodes
Diffstat (limited to 'lib/html/index.js')
-rw-r--r--lib/html/index.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/html/index.js b/lib/html/index.js
index f9e957a..41d348f 100644
--- a/lib/html/index.js
+++ b/lib/html/index.js
@@ -1,5 +1,17 @@
-var ast = require("./ast.js");
+var ast = require("./ast");
exports.fragment = ast.fragment;
exports.element = ast.element;
+exports.elementWithTag = ast.elementWithTag;
exports.text = ast.text;
+
+function pathToNode(path, children) {
+ var result = ast.fragment(children);
+ for (var index = path.length - 1; index >= 0; index--) {
+ result = ast.elementWithTag(path[index], [result]);
+ }
+ return result;
+}
+
+exports.pathToNode = pathToNode;
+exports.simplify = require("./simplify");