diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:56:47 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:56:47 +0100 |
| commit | 03716aafae79ce637bd130b006faac3ffd42499d (patch) | |
| tree | fcce77f79b4bbdc12769e2532dae69a17c7e6d73 | |
| parent | 0695263132193745d7f543fb1a20b63dbfe00075 (diff) | |
Use open/close names rather than push/pop for HtmlGenerator
| -rw-r--r-- | lib/document-to-html.js | 8 | ||||
| -rw-r--r-- | lib/html-generator.js | 18 |
2 files changed, 13 insertions, 13 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index 8fe2f0f..e5c1def 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -58,10 +58,10 @@ function DocumentConverter(options) { } } if (run.isBold) { - runHtml.push(htmlPaths.element("strong")); + runHtml.open(htmlPaths.element("strong")); } if (run.isItalic) { - runHtml.push(htmlPaths.element("em")); + runHtml.open(htmlPaths.element("em")); } return convertElements(run.children, runHtml) .then(function() { @@ -80,9 +80,9 @@ function DocumentConverter(options) { html.text(element.value); }, "hyperlink": function(element, html) { - html.push(htmlPaths.element("a", {href: element.href})); + html.open(htmlPaths.element("a", {href: element.href})); return convertElements(element.children, html).then(function() { - html.pop(); + html.close(); }); }, "image": function(element, html) { diff --git a/lib/html-generator.js b/lib/html-generator.js index 6a8fb32..fd6aac7 100644 --- a/lib/html-generator.js +++ b/lib/html-generator.js @@ -39,10 +39,10 @@ function HtmlGenerator() { partIndex++; } while (stack.length > partIndex) { - pop(); + close(); } for (; partIndex < style.length; partIndex++) { - push(style[partIndex]); + open(style[partIndex]); } } @@ -50,23 +50,23 @@ function HtmlGenerator() { return stackElement && stylePart.tagName === stackElement.element.tagName; } - function push(element) { + function open(element) { stack.push({ element: element, written: false }); } - function pop() { + function close() { var stackElement = stack.pop(); if (stackElement.written) { fragments.push(util.format("</%s>", stackElement.element.tagName)); } } - function popAll() { + function closeAll() { while (stack.length > 0) { - pop(); + close(); } } @@ -97,11 +97,11 @@ function HtmlGenerator() { return { style: style, text: text, - closeAll: popAll, + open: open, + close: close, + closeAll: closeAll, asString: asString, append: append, - push: push, - pop: pop, selfClosing: selfClosing, _fragments: fragments }; |
