Tags:
create new tag
view all tags

Feature Request: added a format parameter to the ACTIVATEDPLUGINS tag

Motivation

The ACTIVATEDPLUGINS tag was rendering a comma separated list by default. But I need an unordered list of them in the NatSkin.

Description

Adds an optionional format argument to the %ACTIVATEDPLUGINS% tag.

Documentation

This change is completely backwards-compatible to the old usage of this tag, that is the default format string is "$web.$topic, " . The format argument will expand the following set of variables

variable value example
$web the web where the plugin is found TWiki
$topic the name of the topic describing a plugin EditTablePlugin
$name the topic name with the postfix "Plugin" stripped off EditTable

Examples

Here's a snipplet from the current editsidebar.nat.tmpl of the NatSkin

<ul>
%ACTIVATEDPLUGINS{format="<li><a href=\"javascript:launchWindow('$web','$topic');\">$name</a></li>"}%
</ul>

Implementation

The patch is extending the function _handleACTIVATEDPLUGINS() in the described way.

Note: Patch is attached as https://www.twiki.org/p/pub/Codev/MoreFlexibleACTIVATEDPLUGINSTag/Plugins_pm.diff. The patch is against the current DevelopBranch


Discussion:

I don't understand your first remark; activated plugins are listed in that specific order, because that is the order that their handlers are called in. Besides, once you have that list, you can use the features of the SpreadSheetPlugin to manipulate it, can't you? Why do we need this extra code? It feels like the thin end of an expensive wedge; why shouldn't all the tags that return lists have a format parameter?

I do not favour adding this patch, until it is established that you can't do the same with SpreadSheetPlugin.

-- CrawfordCurrie - 02 Apr 2005

I tried to figure out the merits of the SpreadSheetPlugin but had a hard time. Gimme a hint on how to format a list using the SpreadSheetPlugin the way the proposed patch would allow to and I will be happy. Tried some but the resulting CALC expression is unreliable, unmaintainable horror. Calling CALC is presumably more expensive than a format parameter. Adding it to some other tags also would be very convenient.

("unordered list" -> <ul> ... </ul>)

-- MichaelDaum - 02 Apr 2005

I can imagine it's pretty horrible; but you are missing the point. We have a nice, simple tag that returns a comma-separated list of atoms. Rather than complicating that tag by adding a format parameter, I would far rather use a generic mechanism.

For example, you could:

%FORMATLIST{ "%ACTIVATEDPLUGINS%", split="(\w+)\.(\w+)Plugin" format="<li><a href=\"javascript:launchWindow('$1','${2}Plugin');\">$2</a></li>" }%
that could then be used to format other tags that return lists.

That would be almost generic enough to impress me. wink What would really impress me would be a clean way to expose the full power of perl split, join, grep and map - but that requires very careful design. Hint, hint.

-- CrawfordCurrie - 03 Apr 2005

Oh, you are right. This is what I need (changed CurrentState).

-- MichaelDaum - 04 Apr 2005

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff Plugins_pm.diff r2 r1 manage 0.9 K 2005-03-28 - 02:12 UnknownUser  
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2005-04-14 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.