fixed tag to process containers in appropriate order instead of inline.
This commit is contained in:
parent
1c7edf3118
commit
4d6b1e80b3
12
Tag.cpp
12
Tag.cpp
@ -97,7 +97,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
} else
|
||||
parseContainer(in);
|
||||
parseContainer(in, out);
|
||||
}
|
||||
|
||||
Tag::~Tag() {
|
||||
@ -112,12 +112,12 @@ namespace jet {
|
||||
variables[keyword] = KeywordValue(variables[keyword], global, parent->variables);
|
||||
}
|
||||
|
||||
void Tag::processContainer(coreutils::ZString &container, coreutils::ZString container2) {
|
||||
void Tag::processContainer(coreutils::ZString &container) {
|
||||
if(hasContainer && evaluate)
|
||||
parseContainer(container, container2);
|
||||
parseContainer(container, out);
|
||||
}
|
||||
|
||||
void Tag::parseContainer(coreutils::ZString &in, coreutils::ZString container2) {
|
||||
void Tag::parseContainer(coreutils::ZString &in, coreutils::MString &out) {
|
||||
coreutils::ZString tag;
|
||||
char *start = in.getCursor();
|
||||
while(!in.eod()) {
|
||||
@ -189,7 +189,8 @@ namespace jet {
|
||||
__dotag _dotag(in, out, global, this);
|
||||
continue;
|
||||
} else if(ifTagName(in, "container")) {
|
||||
processContainer(container2);
|
||||
while(!containerOut.eod())
|
||||
out.write(containerOut.nextChar());
|
||||
in.ifNext("<container");
|
||||
in.skipWhitespace();
|
||||
in.ifNext("/>");
|
||||
@ -197,6 +198,7 @@ namespace jet {
|
||||
} else {
|
||||
out.write(in.charAt(0));
|
||||
in.nextChar();
|
||||
continue;
|
||||
}
|
||||
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
||||
out.write(global.getVariable(in, variables));
|
||||
|
5
Tag.h
5
Tag.h
@ -25,14 +25,15 @@ namespace jet {
|
||||
bool hasContainer;
|
||||
bool hasContainer2;
|
||||
bool variableDefined(coreutils::ZString variable);
|
||||
void parseContainer(coreutils::ZString &in, coreutils::ZString container2 = NULL);
|
||||
void processContainer(coreutils::ZString &container, coreutils::ZString container2 = NULL);
|
||||
void parseContainer(coreutils::ZString &in, coreutils::MString &out);
|
||||
void processContainer(coreutils::ZString &container);
|
||||
void copyContainer(coreutils::ZString &in, coreutils::MString &out);
|
||||
|
||||
Global &global;
|
||||
|
||||
coreutils::MString &parentOut;
|
||||
coreutils::MString out;
|
||||
coreutils::MString containerOut;
|
||||
|
||||
bool output = true;
|
||||
bool evaluate = true;
|
||||
|
@ -4,9 +4,12 @@
|
||||
namespace jet {
|
||||
|
||||
__dotag::__dotag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
|
||||
hasContainer = true;
|
||||
if(hasContainer)
|
||||
parseContainer(container, containerOut);
|
||||
containerOut.reset();
|
||||
coreutils::ZString container3 = global.tags[name];
|
||||
processContainer(container3, container);
|
||||
hasContainer = true;
|
||||
processContainer(container3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<set name="division" expr="5/3" />
|
||||
<set name="divisor" value="8" />
|
||||
<set name="nested" expr="(2*(4+4)/$[divisor])*32" />
|
||||
$[$nested]
|
||||
$[nested]
|
||||
<set name="numbers">0123456789</set>
|
||||
<set name="lefty" expr="LEFT($[numbers],5)" />
|
||||
lefty=[$[lefty]]
|
||||
|
@ -1,16 +1,17 @@
|
||||
#!../jet-2.0
|
||||
<jet filterblanklines="true" trimlines="true">
|
||||
<tag name="test">
|
||||
x
|
||||
<set name="ix" expr="$[ix]+1" />
|
||||
<tag name="testform">
|
||||
<form>
|
||||
1-$[test]
|
||||
<container />
|
||||
$[ix]
|
||||
z
|
||||
2-$[test]
|
||||
</form>
|
||||
</tag>
|
||||
<set name="ix" value="1" />
|
||||
<test>
|
||||
y
|
||||
<set name="ix" expr="$[ix]+3" />
|
||||
</test>
|
||||
<test />
|
||||
<testform>
|
||||
a
|
||||
<input type="input" name="name" />
|
||||
<set name="test" value="itsset" />
|
||||
b
|
||||
</testform>
|
||||
</jet>
|
Loading…
x
Reference in New Issue
Block a user