rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: rejetto on November 04, 2007, 11:20:08 PM
-
symbol %urlvar% is no more.
it is different from other symbols, it requires more power.
it's a new thing, it's a macro, and urlvar is the first of this new generation. wow ::)
the syntax is different.
initially i thought to keep the %old syntax%, but this can be ambiguous for the user and slow for the computer (because % is both beginning and ending).
i introduce a new syntax that should be easy to see and to type.
so it would be {{urlvar|sort}} to read the content of 'sort'.
any suggestion for a different syntax should be adequately justified.
i was uncertain about using {single pairs}, but this way it should be more visbile and hardly collide with other syntaxes. to type twice the same char is fast.
[[double square brackets]] are easier to type, but can easily collide with [section] names in the template.
if this experiment with macros is successful, then user symbols %sym-anything% will be deprecated. they will be subsituted by the macro {{section|name}}.
all this will be since build #139
-
for those geek who like to know WHY macros. :)
macros are somewhat faster for the template engine. because its value is calculated only when it is met. it is not calculated if it is not there.
macros can be void. if you use %urlvar-thing% but there is no thing parameter in URL instead of a having an empty space you will get %urlvar-thing% printed on your page. this can't be solved with the symbols engine.
with the %sym-thing% you are constrained in calling your section [sym-thing]. you can't just name it [yeah].
with macros you will be able to recall the content of [yeah] with {{section|yeah}}.
macros can have any number of parameters separated by |.
i could eventually create a macro "add" and it would work like {{add|3|5}} and 8 would be the output.
"add" is not very useful, but it's just to show you what it can do more than %symbols%.
-
I'am not sure to have understood the syntax of the macro feature.
When in next build [sym-thing] is deprecated can I do a quick change in the template like this:
Supose y have now [sym-info], [sym-header]... that replace %sym-info%... etc.
Can y simply leave my [sym-thing] sections and change the calls (%sym-info%...) to
{{section|sym-info}}, {{section|sym-header}} ?
Is it correct that we will have initially two macros 'section' and 'urlvar' ?
-
yes, all correct
-
This is great; but even better is that it is coming out before the two major releases, thunderchicken of glory and terayon will be able to implement the new changes before their release, only two or so weeks away!
As usual, good work Massimo.
-Kurt
-
This is great; but even better is that it is coming out before the two major releases, thunderchicken of glory and terayon will be able to implement the new changes before their release, only two or so weeks away!
If rejetto keeps adding new features we might have to wait even longer for them, but I can live with that because I always like a new feature to play with ;D
-
http://www.rawr-designs.com/tog/todo.php
Now that I have time from university, I have pushed 2 projects to the next build, only 2 more until release of 3.0.0.
-
i have been working hard on the macros engine.
now it supports macro in macro.
this is an argumen for "experts", so if you truly have no idea of what i'm talking about, it's normal, pass on. :)
in next build i will use this syntax to make the search appear only when the recursive listing is enabled:
{{if| {{get|recursive}} | {{section|search }} /if}}
the final /if is optional, it's only for readability, to avoid confusion with many parenthesis. every macro can have it, it's just ignored by hfs.
to increase readability you can even split the macros over several lines, indenting.
-
Il va falloir sérieusement remettre à jour la version de "tpl.hlp.rtf" dans les sources cher ami rejetto. ;D
-
I'm documenting all the thing at http://www.rejetto.com/wiki/index.php?title=HFS:_Template_macros
-
hey templaters, you shall look at the way i'm changing the tpl for build #144
you'll be surprised of what macros can do :)
-
I can't wait for this :)
-
Imagine the possibilities. :O
-
Imagine the possibilities. :O
Slogan for HFS maybe? ;)
-
Imagine the possibilities. :O
Slogan for HFS maybe? ;)
I like it. :)
Imagine the possibilities... :o
-
do you like having a macro like
{{ CASE | {{macrotest}} | {{ident1}},{{ident2}}:{{result1}} | {{ident3}},..,{{identN}}:{{result12}} |........| ELSE:{{ElseResult}} }}
all {{ident}} are type of strings
{{macrotest}} is type of string
all {{result}} are what you want
the use of this? it is by example
{{CASE | %lang% | en , us :{{section|english}} | fr , be: :{{section|french}} |...| ru : :{{section|russian}} |ELSE :{{section|english}} }}
-
ok for 'case'
but you are using commas as separator.
commas may be part of ident1.
we need a smarter solution.
making the second parameter specify the separator would solve, it's just a bit ugly.
-
To avoid the problem here is a new syntax with
'en'||'us'
'en';'us'
'en'&'us'
'en'!'us'
[en][us]
'en'='us'
{{CASE | '%lang%' | 'en' & ..& 'us' :{{section|english}} | 'fr' & 'be': :{{section|french}} |...| 'ru' :{{section|russian}} |/ELSE :{{section|english}} |/CASE}}
or
{{CASE | '%lang%' | 'en' / ../ 'us' :{{section|english}} | 'fr' / 'be': :{{section|french}} |...| 'ru' :{{section|russian}} |/ELSE :{{section|english}} |/CASE}}
I put / before ELSE to not to confuse with %test%=ELSE
if you don't want comma, you can use another separator a none dos name character in ( \ / : * ? " < >)
-
mars, your suggestions don't solve the problem at all.
changing the character is not a solution.
-
rejetto change what you want, result must be same like (case of else end) in delphi code and syntax similar
-
hey templaters, you shall look at the way i'm changing the tpl for build #144
you'll be surprised of what macros can do :)
OMGWTFBBQ :o imagine the possibilities!! [/quote]
really! this is amazing.
Who needs php now!?
-
Since i didn't found a better solution for the switch statement, i adopted the one i cited above.
{{switch}} is coming in #147 and is already documented.
-
And what think of of this:
if pars.Count < 1 then exit; // from here, only macros with parameters
if name = 'length' then
try result:=Length(result) except end;
if name = 'uppercase' then
try result:= AnsiUpperCase(result) except end;
if name = 'lowercase' then
try result:= AnsiLowerCase(result) except end;
if name = 'trim' then
try result:= Trim(result) except end;
if name = 'trimleft' then
try result:= TrimLeft(result) except end;
if name = 'trimright' then
try result:= TrimRight(result) except end;
if name = 'contains' then
try result:=AnsiContainsStr(result) except end;
if pars.count < 2 then exit; // from here, only macros with at least 2 parameters
That can serve in certain cases ...... the others are for the study. ;D
to be followed...
-
ok for trim, upper, lower, length, is substring