aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-04-10 14:33:36 +0100
committerMichael Williamson <mike@zwobble.org>2014-04-10 14:33:36 +0100
commit0201587bec80aac0c1dcbf12c50ea6d459321585 (patch)
tree58a158b542e4ec76ceec81c4bde8a8c64b34ed48 /lib
parent91eb47cc9c8b82bc171f818046c8100e3420a2b2 (diff)
Indent appened HTML
Diffstat (limited to 'lib')
-rw-r--r--lib/html-writer.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/html-writer.js b/lib/html-writer.js
index be35d52..c144261 100644
--- a/lib/html-writer.js
+++ b/lib/html-writer.js
@@ -57,6 +57,11 @@ function prettyWriter() {
writer.selfClosing(tagName, attributes);
}
+ function append(html) {
+ indent();
+ writer.append(html.replace("\n", "\n" + indentation));
+ }
+
function insideIndentedElement() {
return stack.length === 0 || indentedElements[stack[stack.length - 1]];
}
@@ -76,7 +81,7 @@ function prettyWriter() {
close: close,
text: text,
selfClosing: selfClosing,
- append: writer.append
+ append: append
};
}