From 3d1e91e36b259dc8a648c43134f91d334b8d2da4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 12 May 2018 18:37:56 +0100 Subject: Remove unused code --- lib/writers/html-writer.js | 14 ++++---------- lib/writers/markdown-writer.js | 7 +------ test/writers/html-writer.tests.js | 6 +++--- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/lib/writers/html-writer.js b/lib/writers/html-writer.js index e16feec..16c848f 100644 --- a/lib/writers/html-writer.js +++ b/lib/writers/html-writer.js @@ -62,11 +62,6 @@ function prettyWriter() { writer.selfClosing(tagName, attributes); } - function append(html) { - startText(); - writer.append(html.replace("\n", "\n" + indentation)); - } - function insideIndentedElement() { return stack.length === 0 || indentedElements[stack[stack.length - 1]]; } @@ -81,9 +76,9 @@ function prettyWriter() { function indent() { inText = false; if (!start && insideIndentedElement() && !isInPre()) { - writer.append("\n"); + writer._append("\n"); for (var i = 0; i < indentationLevel; i++) { - writer.append(indentation); + writer._append(indentation); } } } @@ -99,8 +94,7 @@ function prettyWriter() { open: open, close: close, text: text, - selfClosing: selfClosing, - append: append + selfClosing: selfClosing }; } @@ -146,7 +140,7 @@ function simpleWriter() { close: close, text: text, selfClosing: selfClosing, - append: append + _append: append }; } diff --git a/lib/writers/markdown-writer.js b/lib/writers/markdown-writer.js index 4284532..a89ad9f 100644 --- a/lib/writers/markdown-writer.js +++ b/lib/writers/markdown-writer.js @@ -141,10 +141,6 @@ function markdownWriter() { fragments.push(escapeMarkdown(value)); } - function append(html) { - fragments.push(html); - } - function asString() { return fragments.join(""); } @@ -154,8 +150,7 @@ function markdownWriter() { open: open, close: close, text: text, - selfClosing: selfClosing, - append: append + selfClosing: selfClosing }; } diff --git a/test/writers/html-writer.tests.js b/test/writers/html-writer.tests.js index b91cba8..0b48d73 100644 --- a/test/writers/html-writer.tests.js +++ b/test/writers/html-writer.tests.js @@ -92,8 +92,8 @@ test('run of text has only one new line', function() { test('run of html has only one new line', function() { var writer = htmlWriter.writer({prettyPrint: true}); writer.open("p"); - writer.append("One"); - writer.append("Two"); + writer.text("One"); + writer.text("Two"); writer.close("p"); return assert.equal(writer.asString(), "

\n OneTwo\n

"); }); @@ -109,7 +109,7 @@ test('self closing elements are indented', function() { test('newlines in appended HTML are indented', function() { var writer = htmlWriter.writer({prettyPrint: true}); writer.open("p"); - writer.append("One\nTwo"); + writer.text("One\nTwo"); writer.close("p"); return assert.equal(writer.asString(), "

\n One\n Two\n

"); }); -- cgit v1.2.3