Priority: Enhancement
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: FilterPlugin
Branches: master
It would be nice in using the
SUBST
or
EXTRACT
macros with topic parameter to also be able to reference a different revision than the current one. I'd propose simply to add
rev
parameter similar to that in
VarINCLUDE,
VarQUERY, and
VarFORMFIELD.
--
LynnwoodBrown - 24 Oct 2018
Out of curiousity, I dove into the code of FilterPlugin and found on
line 104 this call:
(undef, $text) = Foswiki::Func::readTopic($theWeb, $theTopic);
. Digging into
/lib/Foswiki/Func.pm
, I found the
readTopic subroutine actually can take a rev parameter. This made me wonder if this might be pretty simple so I tried the following small change to
/lib/Foswiki/Plugins/FilterPlugin/Core.pm
:
*** Core.orig 2018-10-24 18:08:30.772896067 -0400
--- Core.pm 2018-10-24 18:11:29.687143106 -0400
***************
*** 87,88 ****
--- 87,89 ----
my $theReverse = $params->{reverse} || '';
+ my $theRev = $params->{rev} || '';
***************
*** 103,105 ****
$this->{filteredTopic}{"$theWeb.$theTopic"} = 1;
! (undef, $text) = Foswiki::Func::readTopic($theWeb, $theTopic);
$text = '' unless defined $text;
--- 104,106 ----
$this->{filteredTopic}{"$theWeb.$theTopic"} = 1;
! (undef, $text) = Foswiki::Func::readTopic($theWeb, $theTopic, $theRev);
$text = '' unless defined $text;
Lo and behold, it seems to work. I have no idea what other ramifications there might be from my tinkering. Perhaps someone with more understanding could comment.
Maybe I'm getting ahead of myself, but here's the simple change needed in the documentation. Under
SUBST macro section, add a second bullet item after
topic
parameter that says:
- rev="...": revision number of topic to be processed. (Use only digits which follow decimal point.) Defaults to latest version.
--
Main.LynnwoodBrown - 25 Oct 2018 - 02:39
Thanks for spotting the missing feature!
--
MichaelDaum - 25 Oct 2018