forked from external/vscode-xml
Merge pull request #324 from DotJoshJohnson/bug/288-trailing-whitespace
Trim Trailing Whitespace from Split Attributes
This commit is contained in:
commit
5af8142204
@ -163,6 +163,10 @@ export class V2XmlFormatter implements XmlFormatter {
|
||||
&& ((options.splitXmlnsOnFormat
|
||||
&& xml.substr(i, 5).toLowerCase() === "xmlns")
|
||||
|| options.splitAttributesOnFormat)) {
|
||||
|
||||
// trim the end of output here to ensure there is no trailing whitespace (issue #288)
|
||||
output = this._removeTrailingNonBreakingWhitespace(output);
|
||||
|
||||
output += `${options.newLine}${this._getIndent(options, indentLevel)}`;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,10 @@ describe("V2XmlFormatter", () => {
|
||||
it("should not touch CDATA content", () => {
|
||||
testFormatter(xmlFormatter, options, "issue-293");
|
||||
});
|
||||
|
||||
it("should not add trailing whitespace", () => {
|
||||
testFormatter(xmlFormatter, options, "issue-288");
|
||||
});
|
||||
});
|
||||
|
||||
describe("#minifyXml(xml, options)", () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE xml>
|
||||
<core:FragmentDefinition xmlns="sap.m"
|
||||
<core:FragmentDefinition xmlns="sap.m"
|
||||
xmlns:core="sap.ui.core">
|
||||
<Text text="{parts: ['i18n>dialog.countdown.text','view>/Countdown'],formatter: 'jQuery.sap.formatMessage'}" />
|
||||
</core:FragmentDefinition>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="2.0"
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
|
||||
|
||||
|
11
src/test/test-data/issue-288.formatted.xml
Normal file
11
src/test/test-data/issue-288.formatted.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://purl.org/rss/1.0/"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
|
||||
xmlns:admin="http://webns.net/mvcb/">
|
||||
|
||||
</rdf:RDF>
|
11
src/test/test-data/issue-288.unformatted.xml
Normal file
11
src/test/test-data/issue-288.unformatted.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://purl.org/rss/1.0/"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
|
||||
xmlns:admin="http://webns.net/mvcb/">
|
||||
|
||||
</rdf:RDF>
|
Loading…
Reference in New Issue
Block a user