Fixed the scope="local" on set tag.

This commit is contained in:
Brad Arant 2024-10-30 16:59:57 -07:00
parent ae4ff5a3dc
commit 9dcedd302b
3 changed files with 7 additions and 6 deletions

3
Tag.h
View File

@ -13,6 +13,8 @@ namespace jet {
public:
Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName = "");
virtual ~Tag();
std::map<coreutils::ZString, coreutils::MString> variables;
coreutils::ZString name;
coreutils::ZString container;
coreutils::ZString container2;
@ -20,7 +22,6 @@ namespace jet {
protected:
bool hasContainer;
bool hasContainer2;
std::map<coreutils::ZString, coreutils::MString> variables;
bool variableDefined(coreutils::ZString variable);
void parseContainer(coreutils::ZString &in, coreutils::ZString container2 = NULL);
void processContainer(coreutils::ZString &container, coreutils::ZString container2 = NULL);

View File

@ -24,25 +24,25 @@ namespace jet {
if(!variableDefined("scope") || (variables["scope"] == "global"))
global.variables[variables["name"]] = Operand(variables["expr"]).string;
else if(variables["scope"] == "local")
variables[variables["name"]] = Operand(variables["expr"]).string;
parent->variables[variables["name"]] = Operand(variables["expr"]).string;
} else if(hasContainer) {
processContainer(container);
if(evaluate) {
if(!variableDefined("scope") || (variables["scope"] == "global"))
global.variables[variables["name"]] = out;
else if(variables["scope"] == "local")
variables[variables["name"]] = out;
parent->variables[variables["name"]] = out;
} else {
if(!variableDefined("scope") || (variables["scope"] == "global"))
global.variables[variables["name"]] = container;
else if(variables["scope"] == "local")
variables[variables["name"]] = container;
parent->variables[variables["name"]] = container;
}
} else {
if(!variableDefined("scope") || (variables["scope"] == "global"))
global.variables[variables["name"]] = variables["value"];
else if(variables["scope"] == "local")
variables[variables["name"]] = variables["value"];
parent->variables[variables["name"]] = variables["value"];
}
}

View File

@ -1,4 +1,4 @@
#!./jet-2.0
#!../jet-2.0
<jet cgi="true" name1="localname" filterblanklines="true" trimlines="true">
<set name="testvar" value="do you see this" scope="local" />
#[testvar]