You are here: Foswiki>Sandbox Web>MakrosTest (01 Sep 2021, TobiasHabermann)Edit Attach

SkinTemplates

https://foswiki.org/System/SkinTemplates

Source:
%TMPL:DEF{"x"}% x%P%z %TMPL:END%

%TMPL:P{"x" P="y"}%


Output:

%TMPL:DEF{"x"}% xREFACTORz %TMPL:END%


Geht nicht frown, sad smile

Makros

https://foswiki.org/System/Macros

Source:

<style>
   * Set FOO = foo
</style>
%FOO%


Output: foo

Makro mit Parameter

<style>
   * Set TEST = lalala %TEXT%
</style>
%TEST{TEXT="test"}%


lalala test


Parameters (Set TEST = ...) are applied within verbatim!

Makro vs verbatim

<style>
   * Set MYVERBATIM = verbatim: <br><verbatim>%TEXT%</verbatim> <br> out:<br>  %TEXT%
</style>
%MYVERBATIM{TEXT="moo"}%


verbatim:
%TEXT%

out:
moo


Macros are not expanded inside verbatim!

Makro vs literal

<style>
   * Set MYLITERAL = literal: <br><literal>%TEXT%</literal> <br> out:<br>  %TEXT%
</style>
%MYLITERAL{TEXT="moo"}%


literal:
moo
out:
moo


Makros are expanded in literal, pre and noautolink, but not in verbatim.

Makro mit Parameter 2

<style>
   * Set MYANCHOR = <a name="%TEXT%"></a>
   * Set MYLINK = [[https://www-acc.gsi.de/wiki/bin/edit/Sandbox/MakrosTest#%TEXT%][%TEXT%]]
</style>
%MYANCHOR{TEXT="dasisteintest"}%
<br><br><br>
%MYLINK{TEXT="dasisteintest"}%





dasisteintest

DEFAULT and default

   * Set WEATHER = It's %DEFAULT{default="sunny"}%.
%WEATHER%
%WEAHTER{"foggy"}%

It's sunny. It's foggy.

DEFAULT is the unnamed parameter.

default

<style>
   * Set MYDEF = It is %X{default="123"}% o'clock.
</style>
%MYDEF%
%MYDEF{X="12"}%

It is ALERT! o'clock. It is 12 o'clock.

default cannot be used for named parameters ?!?

-- TobiasHabermann - 01 Sep 2021
Topic revision: r1 - 01 Sep 2021, TobiasHabermann
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback