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));
|
throw new MarkupException(format("char %d (line %d): %s", pos, getLineNumber(pos), message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void eatWhitespace() {
|
bool eatWhitespace() {
|
||||||
while(pos < data.length && (data[pos] == ' ' || data[pos] == '\n' || data[pos] == '\t' || data[pos] == '\r'))
|
bool ateAny = false;
|
||||||
|
while(pos < data.length && (data[pos] == ' ' || data[pos] == '\n' || data[pos] == '\t' || data[pos] == '\r')) {
|
||||||
pos++;
|
pos++;
|
||||||
|
ateAny = true;
|
||||||
|
}
|
||||||
|
return ateAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
string readTagName() {
|
string readTagName() {
|
||||||
|
@ -999,7 +1003,9 @@ class Document : FileResource {
|
||||||
string attrName = readAttributeName();
|
string attrName = readAttributeName();
|
||||||
string attrValue = attrName;
|
string attrValue = attrName;
|
||||||
|
|
||||||
eatWhitespace;
|
bool ateAny = eatWhitespace();
|
||||||
|
if(strict && ateAny)
|
||||||
|
throw new MarkupException("inappropriate whitespace after attribute name");
|
||||||
|
|
||||||
if(pos >= data.length) {
|
if(pos >= data.length) {
|
||||||
if(strict)
|
if(strict)
|
||||||
|
@ -1012,11 +1018,13 @@ class Document : FileResource {
|
||||||
if(data[pos] == '=') {
|
if(data[pos] == '=') {
|
||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
eatWhitespace;
|
ateAny = eatWhitespace();
|
||||||
|
if(strict && ateAny)
|
||||||
|
throw new MarkupException("inappropriate whitespace after attribute equals");
|
||||||
|
|
||||||
attrValue = readAttributeValue();
|
attrValue = readAttributeValue();
|
||||||
|
|
||||||
eatWhitespace;
|
eatWhitespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
blankValue:
|
blankValue:
|
||||||
|
|
Loading…
Reference in New Issue