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 // entering StartTag.Attribute.AttributeValue
else if (location === Location.Attribute && cc === "\"") { else if (location === Location.Attribute && (cc === "\"" || cc === "'")) {
output += "\""; output += cc;
lastNonTextLocation = location; lastNonTextLocation = location;
location = Location.AttributeValue; location = Location.AttributeValue;
} }
// exiting StartTag.Attribute.AttributeValue, entering StartTag // exiting StartTag.Attribute.AttributeValue, entering StartTag
else if (location === Location.AttributeValue && cc === "\"") { else if (location === Location.AttributeValue && (cc === "\"" || cc === "'")) {
output += "\""; output += cc;
lastNonTextLocation = location; lastNonTextLocation = location;
location = Location.StartTag; location = Location.StartTag;
} }

View File

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

View File

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