mirror of https://github.com/adamdruppe/arsd.git
compile with -w
This commit is contained in:
parent
78821d25bb
commit
b58e50dc23
17
dom.d
17
dom.d
|
@ -772,7 +772,7 @@ class Element {
|
||||||
case "#text":
|
case "#text":
|
||||||
e = new TextNode(null, childInfo);
|
e = new TextNode(null, childInfo);
|
||||||
return e;
|
return e;
|
||||||
break;
|
// break;
|
||||||
case "table":
|
case "table":
|
||||||
e = new Table(null);
|
e = new Table(null);
|
||||||
break;
|
break;
|
||||||
|
@ -3624,12 +3624,13 @@ class Document : FileResource {
|
||||||
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
|
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
|
||||||
{
|
{
|
||||||
pos++;
|
pos++;
|
||||||
if(pos == data.length)
|
if(pos == data.length) {
|
||||||
if(strict)
|
if(strict)
|
||||||
throw new Exception("tag name incomplete when file ended");
|
throw new Exception("tag name incomplete when file ended");
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!caseSensitive)
|
if(!caseSensitive)
|
||||||
return toLower(data[start..pos]);
|
return toLower(data[start..pos]);
|
||||||
|
@ -3644,18 +3645,20 @@ class Document : FileResource {
|
||||||
while( data[pos] != '>' && data[pos] != '/' && data[pos] != '=' &&
|
while( data[pos] != '>' && data[pos] != '/' && data[pos] != '=' &&
|
||||||
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
|
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
|
||||||
{
|
{
|
||||||
if(data[pos] == '<')
|
if(data[pos] == '<') {
|
||||||
if(strict)
|
if(strict)
|
||||||
throw new MarkupException("The character < can never appear in an attribute name. Line " ~ to!string(getLineNumber(pos)));
|
throw new MarkupException("The character < can never appear in an attribute name. Line " ~ to!string(getLineNumber(pos)));
|
||||||
else
|
else
|
||||||
break; // e.g. <a href="something" <img src="poo" /></a>. The > should have been after the href, but some shitty files don't do that right and the browser handles it, so we will too, by pretending the > was indeed there
|
break; // e.g. <a href="something" <img src="poo" /></a>. The > should have been after the href, but some shitty files don't do that right and the browser handles it, so we will too, by pretending the > was indeed there
|
||||||
|
}
|
||||||
pos++;
|
pos++;
|
||||||
if(pos == data.length)
|
if(pos == data.length) {
|
||||||
if(strict)
|
if(strict)
|
||||||
throw new Exception("unterminated attribute name");
|
throw new Exception("unterminated attribute name");
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!caseSensitive)
|
if(!caseSensitive)
|
||||||
return toLower(data[start..pos]);
|
return toLower(data[start..pos]);
|
||||||
|
@ -3950,11 +3953,12 @@ class Document : FileResource {
|
||||||
while(pos < data.length && data[pos] != '>')
|
while(pos < data.length && data[pos] != '>')
|
||||||
pos++;
|
pos++;
|
||||||
//writefln("</%s>", data[p..pos]);
|
//writefln("</%s>", data[p..pos]);
|
||||||
if(pos == data.length && data[pos-1] != '>')
|
if(pos == data.length && data[pos-1] != '>') {
|
||||||
if(strict)
|
if(strict)
|
||||||
throw new MarkupException("File ended before closing tag had a required >");
|
throw new MarkupException("File ended before closing tag had a required >");
|
||||||
else
|
else
|
||||||
data ~= ">"; // just hack it in
|
data ~= ">"; // just hack it in
|
||||||
|
}
|
||||||
pos++; // skip the '>'
|
pos++; // skip the '>'
|
||||||
|
|
||||||
string tname = data[p..pos-1];
|
string tname = data[p..pos-1];
|
||||||
|
@ -4182,13 +4186,14 @@ class Document : FileResource {
|
||||||
default: // it is an attribute
|
default: // it is an attribute
|
||||||
string attrName = readAttributeName();
|
string attrName = readAttributeName();
|
||||||
string attrValue = attrName;
|
string attrValue = attrName;
|
||||||
if(pos >= data.length)
|
if(pos >= data.length) {
|
||||||
if(strict)
|
if(strict)
|
||||||
assert(0, "this should have thrown in readAttributeName");
|
assert(0, "this should have thrown in readAttributeName");
|
||||||
else {
|
else {
|
||||||
data ~= ">";
|
data ~= ">";
|
||||||
goto blankValue;
|
goto blankValue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(data[pos] == '=') {
|
if(data[pos] == '=') {
|
||||||
pos++;
|
pos++;
|
||||||
attrValue = readAttributeValue();
|
attrValue = readAttributeValue();
|
||||||
|
|
Loading…
Reference in New Issue