Question
I've looked through all the questions...sure that this question would have been asked, but I can't find it...
Is it possible to make a custom twiki variable such as:
%FONTCOLOR{color}% that would work in tandem with an end color tag, or better yet,
%FONTCOLOR{color, text to colorize}% (remove the need for users to add a closing tag).
Something like
Set FONTCOLOR{color,text} = <font color="$color">$text</font> seems to be a logical way to do it, but doesn't work.
--
MikeMaurer - 06 Mar 2002
A follow up question... I wanted to do something similar... Say you frequently need to link to a certain external page and pass an argument, and use the argument for the link name too. For example, you want something like
[[http://foobar.com/testpage?topic=Blah][See the notes at Blah]]
It would be nice to be able to use a variable %FOOLINK{'Blah'}% that automatically expands to the above... Any ways at all to do that, barring writing a plugin?
Thanks,
matias
--
MatiasPelenur - 02 Apr 2004
Answer
AFAIK it is not possible (correct me if I am wrong), because of how
TWikiVariables work: they just expand text (the value). But... there is simple workaround. You can see it in
TWikiPreferences, see Miscellaneous Settings section.
Basically, instead of parameter, you have one variable for color name to start colorized text, and another variable to end colorized font. These variables enclose text you want to colorize.
BTW, I proposed to use ENDCOLOR instead of NOCOLOR to end colorized text - more intuitive, IMHO.
--
PeterMasiar - 07 Mar 2002
Thanks, that's basically how we're currently doing it on our wiki, I just thought I'd ask, perhaps in the intermediate-to-distant future something like this could be added, as having to set individual variables is somewhat restrictive. We do use ENDCOLOR on ours, it works very nicely.
--
MikeMaurer - 7 Mar '02
Good point, renamed NOCOLOR to ENDCOLOR.
--
PeterThoeny - 07 Mar 2002