Merge branch 'master' of github.com:adamdruppe/misc-stuff-including-D-programming-language-web-stuff

Conflicts:
	dom.d
This commit is contained in:
Adam D. Ruppe 2011-07-22 20:14:34 -04:00
commit bfc62e677e
2 changed files with 26 additions and 25 deletions

35
dom.d
View File

@ -2122,7 +2122,8 @@ class Document {
pos++;
string v = htmlEntitiesDecode(data[start..pos], strict);
pos++; // skip over the end
return v;
return v;
break;
default:
if(strict)
parseError("Attributes must be quoted");
@ -2239,7 +2240,8 @@ class Document {
if(!caseSensitive)
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...
if(strict)
parseError("bad markup - improperly placed <");
@ -2362,8 +2364,10 @@ class Document {
default: assert(0);
case '/': // self closing tag
return addTag(true);
break;
case '>':
return addTag(false);
break;
case ' ':
case '\t':
case '\n':
@ -2374,8 +2378,11 @@ class Document {
switch(data[pos]) {
case '/': // self closing tag
return addTag(true);
break;
case '>': // closed tag; open -- we now read the contents
return addTag(false);
return addTag(false);
break;
default: // it is an attribute
string attrName = readAttributeName();
string attrValue = attrName;
@ -2643,7 +2650,7 @@ class Document {
string prolog = "<!DOCTYPE html>\n";
///.
override string toString() const {
string toString() const {
return prolog ~ root.toString();
}
@ -3172,7 +3179,13 @@ int intFromHex(string hex) {
current.evenChild = true;
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";
// FIXME
/*
@ -3183,15 +3196,15 @@ int intFromHex(string hex) {
// extensions not implemented
//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";
break;
default:
//if(token.indexOf("lang") == -1)
//assert(0, token);
break;
}
state = State.Starting;
break;
@ -3213,7 +3226,7 @@ int intFromHex(string hex) {
}
break;
}
goto case;
// fallthrough
case State.ExpectingAttributeCloser:
if(token != "]") {
// not the closer; consider it part of comparison
@ -3502,7 +3515,7 @@ class CssStyle {
}
///.
override string toString() {
string toString() {
string ret;
if(originatingRule.length)
ret = originatingRule ~ " {";
@ -3625,7 +3638,7 @@ class StyleSheet {
/*
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
Authors: Adam D. Ruppe
Copyright Adam D. Ruppe 2010-2011.
Distributed under the Boost Software License, Version 1.0.

16
web.d
View File

@ -168,6 +168,7 @@ class ApiProvider {
Document _defaultPage() {
throw new Exception("no default");
return null;
}
Element _getGenericContainer()
@ -1672,12 +1673,10 @@ void formatAs(T, R)(T ret, R api, ref JSONValue returnValue, string format, stri
case "table":
auto document = new Document("<root></root>");
static if(__traits(compiles, structToTable(document, ret)))
{
returnValue.str = structToTable(document, ret).toString();
break;
}
else
goto badType;
break;
default:
badType:
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
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)
*/