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