Question
I've been increasing my use of Glue Plugin; it allows me to break up long lines and makes my TWiki code easier to debug. However, I can't seem to make it work properly with TWISTY.
%~~ TWISTY{
~~~ showlink="Show Me the list"
~~~ showimg="%ICONURLPATH{toggleopen-small}%"
~~~ hidelink="Hide"
~~~ hideimg="%ICONURLPATH{toggleclose-small}%"
~~~ mode="div"
~~~ }%
* item 1
* item 2
%ENDTWISTY%
When I try this, the page "chrome" goes wonky; the web Left Bar drops below the content.
|
- screenshot:
|
If, instead, I use
%TWISTY{showlink="Show Me the list" showimg="%ICONURLPATH{toggleopen-small}%" hidelink="Hide" hideimg="%ICONURLPATH{toggleclose-small}%" mode="div" }%
* item 1
* item 2
%ENDTWISTY%
presentation is as expected.
When I examine the HTML source, the "glued" version appears to be missing one
</div>
Environment
--
VickiBrown - 11 Mar 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
That's probably because the closing ENDTWISTY is processed before the TWISTY that is escaped by the glue chars in the first loop of the twiki parser. Try to make it
%~~ ENDTWISTY%
Btw. you don't need glue just to have the params on separate lines. TWiki does fine with a
%TWISTY{
showlink="Show Me the list"
showimg="%ICONURLPATH{toggleopen-small}%"
hidelink="Hide"
hideimg="%ICONURLPATH{toggleclose-small}%"
mode="div"
}%
* item 1
* item 2
%ENDTWISTY%
--
MichaelDaum - 11 Mar 2008
I tried
%~~ ENDTWISTY% -- that doesn't work either
>
Btw. you don't need glue just to have the params on separate lines.
I wonder when that started to work. It didn't used to.
Well, that solves the need (if not the bug).
--
VickiBrown - 12 Mar 2008
Here's a patch that illustrates the problem and prevents a "Use of uninitialized value in concatenation" error that you should see in your error logs.
--- lib/TWiki/Plugins/TwistyPlugin.pm (revision 16405)
+++ lib/TWiki/Plugins/TwistyPlugin.pm (working copy)
@@ -189,6 +189,10 @@
sub _ENDTWISTYTOGGLE {
my ( $session, $params, $theTopic, $theWeb ) = @_;
my $mode = shift @modes;
+
+ return "<span class='twikiAlert'>woops, ordering error: got an ENDTWISTY before seeing a TWISTY</span>"
+ unless $mode;
+
my $modeTag = ($mode) ? '</' . $mode . '>' : '';
return $modeTag . _wrapInContentHtmlClose();
}
--
MichaelDaum - 12 Mar 2008
Another possible solution: Put the
TwistyPlugin first in the
{PluginsOrder} of configure.
--
PeterThoeny - 12 Mar 2008
That should make any difference as
PluginsOrder only comes into play for plugins using the
commonTagsHandler(). TwistyPlugin however is implemented using
registerTagHandler() so that ordering is regulated within twiki's parser and not with
PluginsOrder. All tags registered to the parser are executed first, even before the first plugin in
PluginsOrder. GluePlugin however pushes tag expansions further down the chain...
--
MichaelDaum - 12 Mar 2008