come back in previous post
about {:|:}, something was not clear.
a simple test with
[+upload-success]
{.if|true|{:{.if|true|{:{.add to log|done{:|:}clred|clgreen.}:}.}:}.}
It looked
done Instead of
done|clredmacro log:
> if|true|{:{.if|true|{:{.add to log|done{:|:}clred|clgreen.}:}.}:}
< {.if|true|{:{.add to log|done|clred|clgreen.}:}.} <<---- the error begin here
> if|true|{:{.add to log|done|clred|clgreen.}:}
< {.add to log|done|clred|clgreen.}
> add to log|done|clred|clgreen
<
main.pas
function noMacrosAllowed(s:string):string; inline;
begin result:=if_(not isAnyMacroIn(s), s) end; // prevent hack attempts
function macroQuoted(s:string):boolean; //add by mars (necessary here)
begin
s:=trim(s);
result:=ansiStartsStr(MARKER_QUOTE, s) and ansiEndsStr(MARKER_UNQUOTE, s);
end;
function macroQuote(s:string):string;
var
t: string;
..............
unnamedPars:=0;
for i:=0 to pars.count-1 do
begin
if not macroquoted(pars[i]) then pars[i]:=xtpl(pars[i], ['{:|:}','|']);
if (i = unnamedPars) and (pos('=',pars[i]) = 0) then
inc(unnamedPars);
end;
new macro log
> if|true|{:{.if|true|{:{.add to log|done{:|:}clred|clgreen.}:}.}:}
< {.if|true|{:{.add to log|done{:|:}clred|clgreen.}:}.}
> if|true|{:{.add to log|done{:|:}clred|clgreen.}:}
< {.add to log|done{:|:}clred|clgreen.}
> add to log|done{:|:}clred|clgreen <<<----- here all is correct
<
this work perfectly in the template
{.set|macroreplace|{:{.add to log|{.no pipe|{.if|%user%|%user% is k{:|:}ng|anonymous.}.}.}:}.}
or
{.set|macroreplace|{:{.add to log|{.if|%user%|{:%user% is k{:|:}ng:}|anonymous.}.}:}.}
with
{.^macroreplace.}
the last test
[request completed]
{.add to log|{.if|%user%|{:%user% is k{:|:}ng:}|you are nothing.}.}
A last small detail which has all its importance:
In this example, we do not want to estimate {.comment|example.}, but just to show it in the log
{.add to log|{:{.comment|example.}:}.} give in the log
{:{.comment|example.}:} , It is not beautiful
if name = 'add to log' then
begin
mainfrm.add2log(macrodequote(p), md.cd, stringToColorEx(par(1,'color'), clDefault));
result:='';
end;
{.add to log|{:{.comment|example.}:}.} give in the log
{.comment|example.} , It is like that better without marker_quote
Here is of what to fill a new version.