+
2
|
list
|
skin
|
login
|
editor
α-wwwiki
::
y
user:none
(2819 bytes)
_h1 a custom style "y" or "z" _h3 1) using [[define]] {define y () °° var args = [].slice.call(arguments).join( ' ' ); var style= "font:normal 0.8em arial;" +"background:#888;" +"color:#fff;" +"text-align:center;" +"margin:20px 50px 0 50px;" +"padding:0 20px;" +"border:1px solid;" +"box-shadow:0px 0px 2px black;" +"-webkit-border-radius:10px;" +"-moz-border-radius:10px;" +"border-radius:10px;"; return '{div {@ style="' + style + '"}' + args + '}'; °°} {y a custom {u cute} tag} _h3 code {pre °° {define y () •• var args = [].slice.call(arguments).join( ' ' ); var style= "font:normal 0.8em arial;" +"background:#888;" +"color:#fff;" +"text-align:center;" +"margin:20px 50px 0 50px;" +"padding:0 20px;" +"border:1px solid;" +"box-shadow:0px 0px 2px black;" +"-webkit-border-radius:10px;" +"-moz-border-radius:10px;" +"border-radius:10px;"; return '{div {@ style="' + style + '"}' + args + '}'; ••} {y a custom {u cute} tag} °°} _h3 2) using [[defun]] function {defun z () °°div {@ style=" font:normal 0.8em arial; background:#888; color:#fff; text-align:center; margin:20px 50px 0 50px; padding:0 20px; border:1px solid; box-shadow:0px 0px 2px black; -webkit-border-radius:10px; -moz-border-radius:10px; border-radius:10px; "}°°} OK {{z} a custom {u cute} tag} _p Note : the two characters " •• " are actually two characters degree " {sup o}{sup o} " ! _h3 code _h5 first solution {pre °° {defun z () ••div {@ style=" font:normal 0.8em arial; background:#888; color:#fff; text-align:center; margin:20px 50px 0 50px; padding:0 20px; border:1px solid; box-shadow:0px 0px 2px black; -webkit-border-radius:10px; -moz-border-radius:10px; border-radius:10px; "}••} {{z} a custom {u cute} tag} °°} _h5 second solution {pre °° {defun mystyle () ••{@ style=" font:normal 0.8em arial; background:#888; color:#fff; text-align:center; margin:20px 50px 0 50px; padding:0 20px; border:1px solid; box-shadow:0px 0px 2px black; -webkit-border-radius:10px; -moz-border-radius:10px; border-radius:10px; "}••} {div {mystyle} a custom {u cute} tag} °°} _p Note : functions "y" and "s" have no arguments. See page [[postit]] for a more intersting example with arguments. _h3 3) and ? _p Using define is difficult to code and easy to use (like any other tag), using defun is easy to code and a little more complex to use (the name has to be between two braces). The first one should be integrated in the core functions. The last may be useful occasionally. A question of context.