rejetto forum

suggestion for {.get.}

Mars · 3 · 4357

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
To go farther to the template:

He can arrive that we wish to combine  several macro GET as

{.and|{.get|can access}|{.get|can upload.}|{.get|can delete.}|{.get|can archive.}/and}
 
or / and

{.or|{.get|can access}|{.get|can upload.}|{.get|can delete.}|{.get|can archive.}/or}

It is very long to write and possible source of error of transcription, then to remedy it I set up a so effective and shorter solution with and/or at choice: 

{.get|and/or|can access|can upload|can delete|can archive.}

I hope that rejetto will agree to include it in the next build under this shape (because I use this formula in a quite new template by default in validation time)

Quote

......
  procedure getMulti();
  var
      i:integer;
  begin
   // the min of  'get|can' is necessary two
  if (pars.Count < 3) and ( p <> 'and' ) and ( p <> 'or' ) then exit;
  result:='{.'+p;
  for I := 1 to  pars.Count- 1 do
      result:=result+'|{.get|'+par(i)+'.}';
  result:=result+'.}';
  end;

.......

.......
   if name = 'get' then
      if p = 'can recur'  then
      .....
     else if p = 'accounts' then
             result:=join(';',
                    ....
                 ))
     else getMulti();
......


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
how many times you are using such code in your template?


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
 :'( : And if the macros {.and|...  and {.or|...  did not still exist, my proposition would be more interesting?

It doesn't much matter the quantity, since the quality is there.

It is the principle which I would apply gladly to the macro, if it allows to relieve the legibility of templates and if it is useful, it is always good to take, because in certain cases even rare, we need a tool adapted for a very precise work.

Less it is necessary to use macro markers, more easily digestible will be the template


forget: You have a MP from me about template
« Last Edit: November 30, 2008, 06:30:14 PM by mars »