Support Single Quotes in Attributes

Issue: #177
This commit is contained in:
Josh Johnson 2018-05-29 18:51:15 -04:00
parent 36820ce320
commit be30a5671b
3 changed files with 8 additions and 8 deletions

View File

@ -120,15 +120,15 @@ export class V2XmlFormatter implements XmlFormatter {
}
// entering StartTag.Attribute.AttributeValue
else if (location === Location.Attribute && cc === "\"") {
output += "\"";
else if (location === Location.Attribute && (cc === "\"" || cc === "'")) {
output += cc;
lastNonTextLocation = location;
location = Location.AttributeValue;
}
// exiting StartTag.Attribute.AttributeValue, entering StartTag
else if (location === Location.AttributeValue && cc === "\"") {
output += "\"";
else if (location === Location.AttributeValue && (cc === "\"" || cc === "'")) {
output += cc;
lastNonTextLocation = location;
location = Location.StartTag;
}

View File

@ -1,4 +1,4 @@
<root>
<element attr='1' />
<element attr='2' />
<element attr='1' />
<element attr='2' />
</root>

View File

@ -1,4 +1,4 @@
<root>
<element attr='1' />
<element attr='2' />
<element attr='1' />
<element attr='2' />
</root>