mirror of https://github.com/adamdruppe/arsd.git
handle whitespace around attribute symbols
This commit is contained in:
parent
b0d21de148
commit
b351656398
18
dom.d
18
dom.d
|
@ -406,9 +406,13 @@ class Document : FileResource {
|
|||
throw new MarkupException(format("char %d (line %d): %s", pos, getLineNumber(pos), message));
|
||||
}
|
||||
|
||||
void eatWhitespace() {
|
||||
while(pos < data.length && (data[pos] == ' ' || data[pos] == '\n' || data[pos] == '\t' || data[pos] == '\r'))
|
||||
bool eatWhitespace() {
|
||||
bool ateAny = false;
|
||||
while(pos < data.length && (data[pos] == ' ' || data[pos] == '\n' || data[pos] == '\t' || data[pos] == '\r')) {
|
||||
pos++;
|
||||
ateAny = true;
|
||||
}
|
||||
return ateAny;
|
||||
}
|
||||
|
||||
string readTagName() {
|
||||
|
@ -999,7 +1003,9 @@ class Document : FileResource {
|
|||
string attrName = readAttributeName();
|
||||
string attrValue = attrName;
|
||||
|
||||
eatWhitespace;
|
||||
bool ateAny = eatWhitespace();
|
||||
if(strict && ateAny)
|
||||
throw new MarkupException("inappropriate whitespace after attribute name");
|
||||
|
||||
if(pos >= data.length) {
|
||||
if(strict)
|
||||
|
@ -1012,11 +1018,13 @@ class Document : FileResource {
|
|||
if(data[pos] == '=') {
|
||||
pos++;
|
||||
|
||||
eatWhitespace;
|
||||
ateAny = eatWhitespace();
|
||||
if(strict && ateAny)
|
||||
throw new MarkupException("inappropriate whitespace after attribute equals");
|
||||
|
||||
attrValue = readAttributeValue();
|
||||
|
||||
eatWhitespace;
|
||||
eatWhitespace();
|
||||
}
|
||||
|
||||
blankValue:
|
||||
|
|
Loading…
Reference in New Issue