fixed some bugs. Added resolveContainerParent flag to resolve set container issue not reading local variables appropriately.
This commit is contained in:
parent
e3d788bc92
commit
bd8aa1c089
3
Tag.cpp
3
Tag.cpp
@ -202,6 +202,9 @@ namespace jet {
|
|||||||
}
|
}
|
||||||
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
||||||
global.errorCursor = in.getCursor();
|
global.errorCursor = in.getCursor();
|
||||||
|
if(resolveContainerParent)
|
||||||
|
out.write(global.getVariable(in, parent->variables));
|
||||||
|
else
|
||||||
out.write(global.getVariable(in, variables));
|
out.write(global.getVariable(in, variables));
|
||||||
} else {
|
} else {
|
||||||
out.write(in.nextChar());
|
out.write(in.nextChar());
|
||||||
|
1
Tag.h
1
Tag.h
@ -40,6 +40,7 @@ namespace jet {
|
|||||||
bool filterBlankLines = false;
|
bool filterBlankLines = false;
|
||||||
bool trimLines = false;
|
bool trimLines = false;
|
||||||
bool cleanWhitespace = false;
|
bool cleanWhitespace = false;
|
||||||
|
bool resolveContainerParent = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool containerOnly = false;
|
bool containerOnly = false;
|
||||||
|
@ -8,6 +8,7 @@ namespace jet {
|
|||||||
|
|
||||||
__set::__set(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
|
__set::__set(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
|
||||||
output = false;
|
output = false;
|
||||||
|
resolveContainerParent = true;
|
||||||
if(!variableDefined("name"))
|
if(!variableDefined("name"))
|
||||||
throw coreutils::Exception("set tag must have name defined.");
|
throw coreutils::Exception("set tag must have name defined.");
|
||||||
if(!variableDefined("expr") && variableDefined("value") && hasContainer)
|
if(!variableDefined("expr") && variableDefined("value") && hasContainer)
|
||||||
|
@ -16,7 +16,6 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
coreutils::MString out;
|
coreutils::MString out;
|
||||||
data.reset();
|
|
||||||
global.errorCursor = data.getCursor();
|
global.errorCursor = data.getCursor();
|
||||||
jet::__jet *jet = new jet::__jet(data, out, global, NULL);
|
jet::__jet *jet = new jet::__jet(data, out, global, NULL);
|
||||||
delete jet;
|
delete jet;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<header name="Content-Type" value="text/html" />
|
<header name="Content-Type" value="text/html" />
|
||||||
<comment>This is a comment and should not show up in the output.</comment>
|
<comment>This is a comment and should not show up in the output.</comment>
|
||||||
<html>
|
<html>
|
||||||
---
|
---#[name1]
|
||||||
<set name="modified1" value="ABCD" />
|
<set name="modified1" value="ABCD" />
|
||||||
$[modified1;tohex]
|
$[modified1;tohex]
|
||||||
<set name="tohex" value="tohex" />
|
<set name="tohex" value="tohex" />
|
||||||
@ -23,8 +23,8 @@
|
|||||||
<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" />
|
||||||
<set name="error" value="$[$x]" />
|
<set name="error" value="$[x]" />
|
||||||
$[$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]]
|
||||||
@ -34,8 +34,8 @@
|
|||||||
5*3($[multiplication])
|
5*3($[multiplication])
|
||||||
5/3($[division])
|
5/3($[division])
|
||||||
<set name="varname$[ix]" value="vardata" scope="global" />
|
<set name="varname$[ix]" value="vardata" scope="global" />
|
||||||
<set name="noeval" eval="no">this is the value store in #[name].</set>
|
<set name="noeval" eval="no">this is the value store in #[name1].</set>
|
||||||
<set name="thename" eval="yes">this is the value store in #[name].</set>
|
<set name="thename" eval="yes">this is the value store in #[name1].</set>
|
||||||
<set name="newname" scope="global">another container value</set>
|
<set name="newname" scope="global">another container value</set>
|
||||||
<include file="./testinclude.jet" />
|
<include file="./testinclude.jet" />
|
||||||
include: $[include]
|
include: $[include]
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#!../jet-2.0
|
#!../jet-2.0
|
||||||
<jet cgi="true" name1="localname" filterblanklines="true" trimlines="true">
|
<jet cgi="true" name1="localname" filterblanklines="true" trimlines="true">
|
||||||
<set name="testvar" value="do you see this" scope="local" />
|
<set name="x" value="#[name1]" />
|
||||||
#[testvar]
|
$[x] $[x]
|
||||||
<for name="ix" start="1" end="5" step="1">
|
|
||||||
-->#[ix]<--
|
|
||||||
</for>
|
|
||||||
</jet>
|
</jet>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user