aboutsummaryrefslogtreecommitdiff
path: root/lib/html-generator.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-03-29 22:57:54 +0000
committerMichael Williamson <mike@zwobble.org>2013-03-29 22:57:54 +0000
commite51abdc358cef3655f074f4ab0e6000623ce4749 (patch)
tree1982623108807c54df0788c6738cc8e8aa48fed3 /lib/html-generator.js
parent370a18d55e1cf97284088c5a1815f9f59ea0bcd7 (diff)
Allow styles to have CSS class
Diffstat (limited to 'lib/html-generator.js')
-rw-r--r--lib/html-generator.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/html-generator.js b/lib/html-generator.js
index 8a67e53..7a03570 100644
--- a/lib/html-generator.js
+++ b/lib/html-generator.js
@@ -31,22 +31,27 @@ function HtmlGenerator() {
pop();
}
for (; partIndex < style.length; partIndex++) {
- push(style[partIndex].tagName);
+ push(style[partIndex]);
}
}
function stylePartMatchesHtmlElement(stylePart, htmlElement) {
- return stylePart.tagName === htmlElement;
+ return htmlElement && stylePart.tagName === htmlElement.tagName;
}
function push(element) {
stack.push(element);
- fragments.push(util.format("<%s>", element));
+ if (element["class"]) {
+ var attributeString = util.format(' %s="%s"', "class", element["class"]);
+ } else {
+ var attributeString = "";
+ }
+ fragments.push(util.format("<%s%s>", element.tagName, attributeString));
}
function pop() {
var element = stack.pop();
- fragments.push(util.format("</%s>", element));
+ fragments.push(util.format("</%s>", element.tagName));
}
function popAll() {