Tags:
create new tag
, view all tags

MacrosPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on MacrosPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Development of MacrosPlugin

-- CrawfordCurrie - 03 Jul 2004

Thanks Crawford for contributing the Plugin, this is useful for some folks.

Small feedback: To avoid confusion, it is better to use conventional TWiki syntax, e.g. write:
%CALLMACRO{topic="MacroMaturity" science="biology" state="mature"}% instead of:
%CALLMACRO{topic=MacroMaturity science="biology" state="mature"}%

I know that your TWiki::Attrs module supports this syntax, but this is not standard. As mentioned in SharedCodeDev I have some concerns on making Plugins dependent on non-standard code.

-- PeterThoeny - 05 Jul 2004

I'm glad you published this separately, Crawford. It is an important step.

It occurs to me that once again we had duplicated functionality - this macro stuff you wrote is similar to the change I made to the TopicVarsPlugin to allow passing in of parameters to facilitate the building of TWikiApplications

-- MartinCleaver - 07 Sep 2004

Cool cool! - thanx

Any chance %CALLMACRO% will honour %STARTINCLUDE%, %STOPINCLUDE%, %TOPIC% ... and the %pattern% argument like %INCLUDE% does?

Hack
I wish to describe "macro help" in the macro topic, but I do not wish to include this help when calling the macro.

I have hacked this, by defining these three variables in my TWiki.TWikiPreferences:

  • Set MACROHELP = <div class="macrohelp">
  • Set MACROHELPEND = </div>
  • Set HIDEMACROHELP = <style>div.macrohelp {display: none;}</style>

The two first are used on in the macro topic, and the last one topics calling the macros.

-- NielsKoldso - 14 Sep 2004

Not any time soon, unless you are inclined to write the code yourself (or pay me to do it). Too many other things to do.

TBH I think this should be part of the standard INCLUDE mechanism, and want to push that direction rather than extending this plugin any further,

-- CrawfordCurrie - 15 Sep 2004

Bug
If a %SEARCH{...}% inside a macro results in variables like %T% , the variables are not expanded in topic calling macro, e.g. %T% is shown instead of TIP

  • Fix
    Patch MacrosPlugin.pm with:
    sub _callMacro {
      ...
      $m =~ s/%CALLMACRO{(.+?)}%/&_callMacro($1,$web,$topic)/geo;
      $m = TWiki::Func::expandCommonVariables($m, $topic, $web); # PATCH -  28/12-2004 (add this line)
      return $m;
    }
-- NielsKoldso - 28 Dec 2004

Bug (?)

We are currently upgrading from a Bejing with FormQueryPlugin to a Cairo release with MacrosPlugin and find that the syntax for %SET has changed? It seems that a empty line is now required after a set-line. Is this intended or a bug.

Test:

%SET HELLO = "How are you doing?" %SET BYE = "Goodbye!"

Evaluates to %HELLO% and %BYE%.

-- ChristopherOezbek - 10 Jan 2005

I was trying to achieve a best way to do block operations:

  • Define blocks of twiki markup (using SET for e.g.)
  • Be able to instantiate them conditionally (this can be taken care of by SpreadSheetPlugin)
  • Be able to susbstitute values in the block to create instances; for e.g. change background value (and otherwise use the default). This is roughly equivalent to CALLMACRO
  • Be able to protect the blocks from rendering - say when you have CSS code or Javascript code defined. (i.e. when you conditionally include some of these blocks in specific pages.)
While INCLUDE could do the trick, it would not integrate with some kind of conditionals. Are there ways that could do the trick without looking at code modifications?

-- VinodKulkarni - 09 Feb 2005

Found an error: macro texts and times are hashed using the topic name as a key but should use the web name as well for obvious reasons.

-- MichaelDaum - 21 Aug 2005

Nobody working on this plugin anymore? It needs a bit of hacking before it can run on Dakar. Would be nice if it recognises STARTINCLUDE as well. I think it's really useful and should be merged into INCLUDE in future releases.

-- JamesTan - 22 Jun 2006

Crawford, please consider upgrading this Plugin so that it runs on Cairo and Dakar codebase.

-- PeterThoeny - 27 Jun 2006

I run this plugin on TWiki4 (Dakar).

The only reason I have it installed is that we have many CALLMACRO calls in existing topics. For new topics we use the TWiki4 INCLUDE which has the same feature set as this old plugin and more.

So for new installations of TWiki you do not need this. INCLUDE does the same. For upgraded installations you may want to run with it for a while until you have had the chance to change old CALLMACRO calls to INCLUDE. The syntax is not 100% the same so you cannot just do a global seach and replace of CALLMACRO into INCLUDE. It requires a little bit of manual work.

But do not expect anyone to work more on this. Further development is more likely to happen on the core INCLUDE feature

-- KennethLavrsen - 27 Jun 2006

Good points Kenneth.

-- PeterThoeny - 27 Jun 2006

Kenneth: Could you please post an example of the porting of CALLMACRO calls to INCLUDE calls and describe briefly what to look for while porting? Thanks!

-- FranzJosefSilli - 28 Jun 2006

The zip and .tgz downloadable versions are different!!!

The version in the .zip file depends on/uses TWiki::Contrib::Attrs. The version in the .tgz file depends on/uses TWiki::Attrs;

Grrr!!!

-- RobertInder - 08 May 2007

I just verified this. Yes, they differ! The .zip lists plugin version 1.001, the .tgz lists 8224. Strangly, they have the same time stamp, e.g. are uploaded by the build script that generates the packages from one and the same source! Crawford, coud you check?

-- PeterThoeny - 16 May 2007

This plugin didn't show up in the list generated by configure (Plugins >> Find More Extensions). frown Perhaps because no more work is planned? in which case, it should appear but say that.

-- VickiBrown - 19 May 2008

I am concerned by the statement that INCLUDE has the same feature set and more and that this plugin will no longer be developed.

As I read the MacrosPlugin docs for %Set, this appears to be a feature that is otherwise missing in TWiki, a feature that is important and badly needed. This is a critically important difference; values that are %SET can be used alongside plugins (such as SpreadSheetPlugin) that are very sensitive to format.

This lacking in SET has driven me quite mad in the past. I'd hate to discover this functionality only to lose it again.

-- VickiBrown - 19 May 2008

The $SET() of %CALC basically behaves like %SET of this plugin, e.g. values are executes in sequence and survive %INLCLUDEs. See for example SpreadSheetRollupTest.

-- PeterThoeny - 22 May 2008

%CALC's $SET behaves a bit different compared to a %SET tag that is implemented using registerTagHandler(). The reason for this is evaluation order: SpreadSheetPlugin is evaluated after all registered tags have been processed but before all other non-registered tags are. This might give supprising results when tags are nested, i.e. in a nested search, and evaluation order is very important for %SETs and %GETs.

-- MichaelDaum - 22 May 2008

Edit | Attach | Watch | Print version | History: r22 < r21 < r20 < r19 < r18 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r22 - 2008-05-22 - MichaelDaum
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.