Add Tests for Fixed Issues
This commit also changes the "fix" for text-only lines. We should be adjusting the text content as little as possible. In this case, we are still adding spaces (or tabs) after the last line break, but that is necessary to indent the closing element. I'll continue to adjust this as needed based on feedback and possibly add a setting to gate this behavior. #137
This commit is contained in:
parent
09fe37f04b
commit
27433b47ce
8 changed files with 34 additions and 15 deletions
|
|
@ -121,21 +121,6 @@ export class V2XmlFormatter implements XmlFormatter {
|
|||
output += `>${options.newLine}`;
|
||||
}
|
||||
|
||||
// if this is an open tag followed by a line break, add an indent before the text (after the line break)
|
||||
// TODO: there could be multiple lines of text here, so we'll need a less naive implementation at some point
|
||||
else if (nc === "\r" || nc === "\n") {
|
||||
output += `>${options.newLine}${this._getIndent(options, indentLevel)}`;
|
||||
|
||||
// fast-forward based on what type of line break was used
|
||||
if (nc === "\r") {
|
||||
i += 2;
|
||||
}
|
||||
|
||||
else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
output += ">";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue