mirror of https://github.com/adamdruppe/arsd.git
blargh
Merge branch 'master' of github.com:adamdruppe/misc-stuff-including-D-programming-language-web-stuff Conflicts: dom.d
This commit is contained in:
commit
bfc62e677e
35
dom.d
35
dom.d
|
@ -2122,7 +2122,8 @@ class Document {
|
||||||
pos++;
|
pos++;
|
||||||
string v = htmlEntitiesDecode(data[start..pos], strict);
|
string v = htmlEntitiesDecode(data[start..pos], strict);
|
||||||
pos++; // skip over the end
|
pos++; // skip over the end
|
||||||
return v;
|
return v;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if(strict)
|
if(strict)
|
||||||
parseError("Attributes must be quoted");
|
parseError("Attributes must be quoted");
|
||||||
|
@ -2239,7 +2240,8 @@ class Document {
|
||||||
if(!caseSensitive)
|
if(!caseSensitive)
|
||||||
tname = tname.toLower;
|
tname = tname.toLower;
|
||||||
|
|
||||||
return Ele(1, null, tname); // closing tag reports itself here
|
return Ele(1, null, tname); // closing tag reports itself here
|
||||||
|
break;
|
||||||
case ' ': // assume it isn't a real element...
|
case ' ': // assume it isn't a real element...
|
||||||
if(strict)
|
if(strict)
|
||||||
parseError("bad markup - improperly placed <");
|
parseError("bad markup - improperly placed <");
|
||||||
|
@ -2362,8 +2364,10 @@ class Document {
|
||||||
default: assert(0);
|
default: assert(0);
|
||||||
case '/': // self closing tag
|
case '/': // self closing tag
|
||||||
return addTag(true);
|
return addTag(true);
|
||||||
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
return addTag(false);
|
return addTag(false);
|
||||||
|
break;
|
||||||
case ' ':
|
case ' ':
|
||||||
case '\t':
|
case '\t':
|
||||||
case '\n':
|
case '\n':
|
||||||
|
@ -2374,8 +2378,11 @@ class Document {
|
||||||
switch(data[pos]) {
|
switch(data[pos]) {
|
||||||
case '/': // self closing tag
|
case '/': // self closing tag
|
||||||
return addTag(true);
|
return addTag(true);
|
||||||
|
break;
|
||||||
case '>': // closed tag; open -- we now read the contents
|
case '>': // closed tag; open -- we now read the contents
|
||||||
return addTag(false);
|
|
||||||
|
return addTag(false);
|
||||||
|
break;
|
||||||
default: // it is an attribute
|
default: // it is an attribute
|
||||||
string attrName = readAttributeName();
|
string attrName = readAttributeName();
|
||||||
string attrValue = attrName;
|
string attrValue = attrName;
|
||||||
|
@ -2643,7 +2650,7 @@ class Document {
|
||||||
string prolog = "<!DOCTYPE html>\n";
|
string prolog = "<!DOCTYPE html>\n";
|
||||||
|
|
||||||
///.
|
///.
|
||||||
override string toString() const {
|
string toString() const {
|
||||||
return prolog ~ root.toString();
|
return prolog ~ root.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3172,7 +3179,13 @@ int intFromHex(string hex) {
|
||||||
current.evenChild = true;
|
current.evenChild = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "visited", "active", "hover", "target", "focus", "checked", "selected":
|
case "visited":
|
||||||
|
case "active":
|
||||||
|
case "hover":
|
||||||
|
case "target":
|
||||||
|
case "focus":
|
||||||
|
case "checked":
|
||||||
|
case "selected":
|
||||||
current.attributesPresent ~= "nothing";
|
current.attributesPresent ~= "nothing";
|
||||||
// FIXME
|
// FIXME
|
||||||
/*
|
/*
|
||||||
|
@ -3183,15 +3196,15 @@ int intFromHex(string hex) {
|
||||||
// extensions not implemented
|
// extensions not implemented
|
||||||
//case "text": // takes the text in the element and wraps it in an element, returning it
|
//case "text": // takes the text in the element and wraps it in an element, returning it
|
||||||
+/
|
+/
|
||||||
goto case;
|
|
||||||
case "before", "after":
|
case "before":
|
||||||
|
case "after":
|
||||||
current.attributesPresent ~= "FIXME";
|
current.attributesPresent ~= "FIXME";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//if(token.indexOf("lang") == -1)
|
//if(token.indexOf("lang") == -1)
|
||||||
//assert(0, token);
|
//assert(0, token);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
state = State.Starting;
|
state = State.Starting;
|
||||||
break;
|
break;
|
||||||
|
@ -3213,7 +3226,7 @@ int intFromHex(string hex) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
goto case;
|
// fallthrough
|
||||||
case State.ExpectingAttributeCloser:
|
case State.ExpectingAttributeCloser:
|
||||||
if(token != "]") {
|
if(token != "]") {
|
||||||
// not the closer; consider it part of comparison
|
// not the closer; consider it part of comparison
|
||||||
|
@ -3502,7 +3515,7 @@ class CssStyle {
|
||||||
}
|
}
|
||||||
|
|
||||||
///.
|
///.
|
||||||
override string toString() {
|
string toString() {
|
||||||
string ret;
|
string ret;
|
||||||
if(originatingRule.length)
|
if(originatingRule.length)
|
||||||
ret = originatingRule ~ " {";
|
ret = originatingRule ~ " {";
|
||||||
|
@ -3625,7 +3638,7 @@ class StyleSheet {
|
||||||
/*
|
/*
|
||||||
Copyright: Adam D. Ruppe, 2010 - 2011
|
Copyright: Adam D. Ruppe, 2010 - 2011
|
||||||
License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
|
License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
|
||||||
Authors: Adam D. Ruppe, with contributions by Nick Sabalausky
|
Authors: Adam D. Ruppe
|
||||||
|
|
||||||
Copyright Adam D. Ruppe 2010-2011.
|
Copyright Adam D. Ruppe 2010-2011.
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
16
web.d
16
web.d
|
@ -168,6 +168,7 @@ class ApiProvider {
|
||||||
|
|
||||||
Document _defaultPage() {
|
Document _defaultPage() {
|
||||||
throw new Exception("no default");
|
throw new Exception("no default");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Element _getGenericContainer()
|
Element _getGenericContainer()
|
||||||
|
@ -1672,12 +1673,10 @@ void formatAs(T, R)(T ret, R api, ref JSONValue returnValue, string format, stri
|
||||||
case "table":
|
case "table":
|
||||||
auto document = new Document("<root></root>");
|
auto document = new Document("<root></root>");
|
||||||
static if(__traits(compiles, structToTable(document, ret)))
|
static if(__traits(compiles, structToTable(document, ret)))
|
||||||
{
|
|
||||||
returnValue.str = structToTable(document, ret).toString();
|
returnValue.str = structToTable(document, ret).toString();
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
goto badType;
|
goto badType;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
badType:
|
badType:
|
||||||
throw new Exception("Couldn't get result as " ~ format);
|
throw new Exception("Couldn't get result as " ~ format);
|
||||||
|
@ -2440,14 +2439,3 @@ really isn't bad anyway.
|
||||||
The benefit for html was very easy and big. I'm not so sure about
|
The benefit for html was very easy and big. I'm not so sure about
|
||||||
css and js.
|
css and js.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright: Adam D. Ruppe, 2010 - 2011
|
|
||||||
License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
|
|
||||||
Authors: Adam D. Ruppe, with contributions by Nick Sabalausky
|
|
||||||
|
|
||||||
Copyright Adam D. Ruppe 2010-2011.
|
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
|
||||||
(See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue