{.for line.} and {.if|var.}

This commit is contained in:
Massimo Melina 2020-05-26 12:09:27 +02:00
parent d1a4b8574a
commit bfe0265119
2 changed files with 43 additions and 1 deletions

View File

@ -923,6 +923,37 @@ var
finally free end;
end; // foreach
procedure forLine();
var
lines: TStringList;
line, code, run: string;
i: integer;
begin
code:=macroDequote(par(pars.count-1));
with TfastStringAppend.create do
try
lines:=TStringList.create();
lines.text:= getVar(par('var'));
for line in lines do
begin
i:=pos('=',line);
if i > 0 then
begin
setVar('line-key', Copy(line, 1, i-1));
setVar('line-value', Copy(line, i+1, MAXINT));
end;
setVar('line', line);
run:=code;
applyMacrosAndSymbols(run, cbMacros, cbData);
append(run);
end;
result:=reset();
finally
Free;
lines.Free;
end;
end; //forLine
procedure for_();
var
b, e, i, d: integer;
@ -2427,8 +2458,12 @@ try
minOrMax();
if stringExists(name, ['if','if not']) then
if isFalse(p) xor (length(name) > 2) then result:=macroDequote(par(2))
begin
try p:=getVar(parEx('var'));
except end;
if isTrue(p) xor (length(name) = 2) then result:=macroDequote(par(2))
else result:=macroDequote(par(1));
end;
if stringExists(name, ['=','>','>=','<','<=','<>','!=']) then
trueIf(compare(name, p, par(1)));
@ -2444,6 +2479,9 @@ try
if name = 'cut' then
cut();
if name ='for line' then
forLine();
if pars.count < 3 then exit; // from here, only macros with at least 3 parameters
if name ='for each' then

View File

@ -12,12 +12,16 @@ propaganda
Mobile-friendly template
Unicode support
Encrypted login, and logout
IPv6
/propaganda
+ new default template
+ new login system, session based, with logout
+ IPv6 support
+ {.set item|name.}
+ {.get item|icon.}
+ {.set cfg.}
+ {.for line.}
+ {.if|var}
+ cache for jquery and template sections
+ new template commands: base64, base64decode, md5, sha1
+ *.diff.tpl in exe's folder