Laid ground work for resolveKeyword method on Tag and to not resolve automatically.
This commit is contained in:
parent
169ad1aa11
commit
d7936de84f
8
Tag.cpp
8
Tag.cpp
@ -51,7 +51,7 @@ namespace jet {
|
||||
if(!finished) {
|
||||
coreutils::ZString keywordName = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");
|
||||
if(in.ifNext("=\"")) {
|
||||
variables[keywordName] = KeywordValue(in.getTokenExclude("\""), global, parent->variables);
|
||||
variables[keywordName] = in.getTokenExclude("\"");
|
||||
}
|
||||
if(!in.ifNext("\"")) {}
|
||||
}
|
||||
@ -91,7 +91,7 @@ namespace jet {
|
||||
} else if(variables["eval"] == "no") {
|
||||
evaluate = false;
|
||||
} else
|
||||
throw coreutils::Exception("Keyword 'eval' must be 'yes' or 'no'.");
|
||||
throw coreutils::Exception("keyword 'eval' must be 'yes' or 'no'.");
|
||||
}
|
||||
}
|
||||
} else
|
||||
@ -106,6 +106,10 @@ namespace jet {
|
||||
copyContainer(container, parentOut);
|
||||
}
|
||||
|
||||
void Tag::resolveKeyword(coreutils::ZString keyword) {
|
||||
variables[keyword] = KeywordValue(variables[keyword], global, variables);
|
||||
}
|
||||
|
||||
void Tag::processContainer(coreutils::ZString &container, coreutils::ZString container2) {
|
||||
if(hasContainer && evaluate)
|
||||
parseContainer(container, container2);
|
||||
|
1
Tag.h
1
Tag.h
@ -14,6 +14,7 @@ namespace jet {
|
||||
Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName = "");
|
||||
virtual ~Tag();
|
||||
|
||||
void resolveKeyword(coreutils::ZString keyword);
|
||||
std::map<coreutils::ZString, coreutils::MString> variables;
|
||||
coreutils::ZString name;
|
||||
coreutils::ZString container;
|
||||
|
@ -10,6 +10,11 @@ namespace jet {
|
||||
if(requestMethod == "POST") {
|
||||
coreutils::ZString contentLength(getenv("CONTENT_LENGTH"));
|
||||
coreutils::ZString contentType(getenv("CONTENT_TYPE"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(contentType == "multipart/form-data")
|
||||
std::cout << "output multipart variables to global" << std::endl;
|
||||
else if(contentType == "application/x-www-form-urlencoded")
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "__set.h"
|
||||
#include "Exception.h"
|
||||
#include "Operand.h"
|
||||
#include "KeywordValue.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace jet {
|
||||
@ -20,7 +21,10 @@ namespace jet {
|
||||
if(variableDefined("expr") && variableDefined("eval"))
|
||||
throw coreutils::Exception("Cannot use eval with expr.");
|
||||
|
||||
resolveKeyword("name");
|
||||
|
||||
if(variableDefined("expr")) {
|
||||
resolveKeyword("eval");
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = Operand(variables["expr"]).string;
|
||||
else if(variables["scope"] == "local")
|
||||
@ -45,6 +49,7 @@ namespace jet {
|
||||
parent->parent->variables[variables["name"]] = container;
|
||||
}
|
||||
} else {
|
||||
resolveKeyword("value");
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = variables["value"];
|
||||
else if(variables["scope"] == "local")
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!../jet-2.0
|
||||
<jet filterblanklines="true" trimlines="true">
|
||||
<set name="ix" value="1" />
|
||||
<set name="ix" value="1" />
|
||||
<set name="letterx" value="x" />
|
||||
<set name="var1" value="this is a test" />
|
||||
<set name="var$[ix]" value="this is a test $[ix]" />
|
||||
<set name="1var1" value="This is another test" />
|
||||
<set name="var1var" value="Yet another test" />
|
||||
<set name="var11" value="it seems to work." />
|
||||
$[$test]
|
||||
$[$[ix]var$[ix]]
|
||||
$[var$[ix]]
|
||||
$[var$[ix]var]
|
||||
@ -14,4 +12,4 @@ $[var$[i$[letterx]]var]
|
||||
$[letterx;TOHEX]
|
||||
$[var$[i$[letterx]]$[ix]]
|
||||
$[var$[i$[letterx]]$[i$[letterx]]]
|
||||
</jet>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user