From 08ef6c436536140f294d37a63a5a85a947185b31 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Wed, 2 May 2018 20:30:42 -0400 Subject: [PATCH] Fix Unnecessary Newline fixes #147 --- src/formatting/formatters/v2-xml-formatter.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/formatting/formatters/v2-xml-formatter.ts b/src/formatting/formatters/v2-xml-formatter.ts index c462a9d..daa7994 100644 --- a/src/formatting/formatters/v2-xml-formatter.ts +++ b/src/formatting/formatters/v2-xml-formatter.ts @@ -138,7 +138,12 @@ export class V2XmlFormatter implements XmlFormatter { // if this was a self-closing tag, we need to decrement the indent level and add a newLine if (pc === "/") { indentLevel--; - output += `>${options.newLine}`; + output += ">"; + + // only add a newline here if one doesn't already exist (issue #147) + if (nc !== "\r" && nc !== "\n") { + output += options.newLine; + } } else {