forked from external/vscode-xml
commit
668fa5894b
@ -121,7 +121,7 @@
|
|||||||
"onCommand:xmlTools.viewXmlTree"
|
"onCommand:xmlTools.viewXmlTree"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vscode": "TrueCommerce/vscode-extension-vscode#519e686",
|
"vscode": "^0.11.8",
|
||||||
"typescript": "^1.6.2",
|
"typescript": "^1.6.2",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-shell": "^0.5.1"
|
"gulp-shell": "^0.5.1"
|
||||||
|
@ -40,7 +40,7 @@ export class XmlFormatter {
|
|||||||
let inComment: boolean = false;
|
let inComment: boolean = false;
|
||||||
let level: number = 0;
|
let level: number = 0;
|
||||||
let output: string = '';
|
let output: string = '';
|
||||||
|
|
||||||
for (let i = 0; i < parts.length; i++) {
|
for (let i = 0; i < parts.length; i++) {
|
||||||
// <!
|
// <!
|
||||||
if (parts[i].search(/<!/) > -1) {
|
if (parts[i].search(/<!/) > -1) {
|
||||||
@ -62,7 +62,7 @@ export class XmlFormatter {
|
|||||||
// <elm></elm>
|
// <elm></elm>
|
||||||
else if (/^<\w/.test(parts[i - 1]) && /^<\/\w/.test(parts[i])
|
else if (/^<\w/.test(parts[i - 1]) && /^<\/\w/.test(parts[i])
|
||||||
&& /^<[\w:\-\.\,]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\,]+/.exec(parts[i])[0].replace('/', '')) {
|
&& /^<[\w:\-\.\,]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\,]+/.exec(parts[i])[0].replace('/', '')) {
|
||||||
|
|
||||||
output += parts[i];
|
output += parts[i];
|
||||||
if (!inComment) level--;
|
if (!inComment) level--;
|
||||||
}
|
}
|
||||||
@ -83,10 +83,15 @@ export class XmlFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// <elm />
|
// <elm />
|
||||||
else if (parts[i].search(/\/>/) > -1) {
|
else if (parts[i].search(/\/>/) > -1 && (!this.splitNamespaces || parts[i].search(/xmlns\:/) == -1)) {
|
||||||
output = (!inComment) ? output += this._getIndent(level, parts[i]) : output += parts[i];
|
output = (!inComment) ? output += this._getIndent(level, parts[i]) : output += parts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xmlns />
|
||||||
|
else if (parts[i].search(/\/>/) > -1 && parts[i].search(/xmlns\:/) > -1 && this.splitNamespaces) {
|
||||||
|
output = (!inComment) ? output += this._getIndent(level--, parts[i]) : output += parts[i];
|
||||||
|
}
|
||||||
|
|
||||||
// <?xml ... ?>
|
// <?xml ... ?>
|
||||||
else if (parts[i].search(/<\?/) > -1) {
|
else if (parts[i].search(/<\?/) > -1) {
|
||||||
output += this._getIndent(level, parts[i]);
|
output += this._getIndent(level, parts[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user