Skip to content

Commit

Permalink
Item8119: detwikification
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/FilterPlugin@3491 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Apr 17, 2009
1 parent 9d88709 commit c033b7a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 40 deletions.
16 changes: 7 additions & 9 deletions data/TWiki/FilterPlugin.txt → data/System/FilterPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1223455374" format="1.1" reprev="1.2" version="$Rev$"}%
%META:TOPICINFO{author="ProjectContributor" date="1223455374" format="1.1" version="$Rev$"}%
<!--

PLEASE DO NOT EDIT THIS TOPIC
Expand Down Expand Up @@ -119,7 +119,7 @@ parameters:
* pattern="...": pattern applied to each item (default "(.*)")
* cols="...": maximum number of cols to split the list into
* format="...": format of each list item (default "$item")
* sort="on/off": sort the list (default "on")
* sort="on,off,alpha,num,nocase": sort the list (default "on")
* unique="on/off": removed duplicates (default "off")
* exclude="...": pattern to check against items in the list to be excluded
* reverse="on/off": reverse the list (default "off")
Expand Down Expand Up @@ -166,11 +166,8 @@ compare with [[http://en.wikipedia.org/wiki/Category:Philosophy_articles_needing
}%

---++ Plugin Installation Instructions
* Download the ZIP file from the Plugin Home (see below)
* Unzip it in your twiki installation directory. Content:
| *File:* | *Description:* |
%$MANIFEST%
* Visit =configure= in your installation, and enable the plugin in the {Plugins} section.
%$INSTALL_INSTRUCTIONS%


---++ Plugin Info
<!--
Expand All @@ -180,8 +177,9 @@ compare with [[http://en.wikipedia.org/wiki/Category:Philosophy_articles_needing
| Plugin Author: | Michael Daum |
| Copyright &copy;: | 2005-2009, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Plugin Version: | v1.70 |
| Plugin Version: | v1.80 |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 17 Apr 2009: | converted to foswiki, added numerical sorting to MAKETEXT |
| 08 Oct 2008: | added =$anchors= to MAKEINDEX (by Dirk Zimoch); \
added =nocase= option to FORMATLIST (by Dirk Zimoch); \
fixed null/empty string match in FORMATLIST |
Expand Down Expand Up @@ -211,6 +209,6 @@ compare with [[http://en.wikipedia.org/wiki/Category:Philosophy_articles_needing
| Other Dependencies: | none |
| Perl Version: | 5.005 |
| Plugin Home: | Foswiki:Extensions/%TOPIC% |
| Feedback: | Foswiki:Extensions/%TOPIC%Dev |
| Support: | Foswiki:Support/%TOPIC% |

%META:FILEATTACHMENT{name="wikiringlogo40x40.png" attr="h" autoattached="1" comment="" date="1189788323" path="wikiringlogo40x40.png" size="2571" user="ProjectContributor" version="1"}%
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2005-2008 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2005-2009 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -14,7 +14,7 @@
# http://www.gnu.org/copyleft/gpl.html
#
###############################################################################
package TWiki::Plugins::FilterPlugin;
package Foswiki::Plugins::FilterPlugin;
use strict;

###############################################################################
Expand All @@ -25,18 +25,18 @@ use vars qw(
);

$VERSION = '$Rev$';
$RELEASE = '1.70';
$RELEASE = '1.80';
$NO_PREFS_IN_TOPIC = 1;
$SHORTDESCRIPTION = 'Substitute and extract information from content by using regular expressions';

###############################################################################
sub initPlugin {
($currentTopic, $currentWeb) = @_;

TWiki::Func::registerTagHandler('FORMATLIST', \&handleFormatList);
TWiki::Func::registerTagHandler('MAKEINDEX', \&handleMakeIndex);
TWiki::Func::registerTagHandler('SUBST', \&handleSubst);
TWiki::Func::registerTagHandler('EXTRACT', \&handleExtract);
Foswiki::Func::registerTagHandler('FORMATLIST', \&handleFormatList);
Foswiki::Func::registerTagHandler('MAKEINDEX', \&handleMakeIndex);
Foswiki::Func::registerTagHandler('SUBST', \&handleSubst);
Foswiki::Func::registerTagHandler('EXTRACT', \&handleExtract);

$doneInitCore = 0;
return 1;
Expand All @@ -58,40 +58,38 @@ sub initCore {
return if $doneInitCore;
$doneInitCore = 1;

eval 'use TWiki::Plugins::FilterPlugin::Core;';
die $@ if $@;

TWiki::Plugins::FilterPlugin::Core::init($currentWeb, $currentTopic);
require Foswiki::Plugins::FilterPlugin::Core;
Foswiki::Plugins::FilterPlugin::Core::init($currentWeb, $currentTopic);
}

###############################################################################
sub handleFilterArea {
initCore();
return TWiki::Plugins::FilterPlugin::Core::handleFilterArea(@_);
return Foswiki::Plugins::FilterPlugin::Core::handleFilterArea(@_);
}

###############################################################################
sub handleFormatList {
initCore();
return TWiki::Plugins::FilterPlugin::Core::handleFormatList(@_);
return Foswiki::Plugins::FilterPlugin::Core::handleFormatList(@_);
}

###############################################################################
sub handleMakeIndex {
initCore();
return TWiki::Plugins::FilterPlugin::Core::handleMakeIndex(@_);
return Foswiki::Plugins::FilterPlugin::Core::handleMakeIndex(@_);
}

###############################################################################
sub handleSubst {
initCore();
return TWiki::Plugins::FilterPlugin::Core::handleSubst(@_);
return Foswiki::Plugins::FilterPlugin::Core::handleSubst(@_);
}

###############################################################################
sub handleExtract {
initCore();
return TWiki::Plugins::FilterPlugin::Core::handleExtract(@_);
return Foswiki::Plugins::FilterPlugin::Core::handleExtract(@_);
}

1;
Expand Up @@ -15,7 +15,7 @@
#
###############################################################################

package TWiki::Plugins::FilterPlugin::Core;
package Foswiki::Plugins::FilterPlugin::Core;
use strict;

use vars qw($currentTopic $currentWeb $mixedAlphaNum %seenAnchorNames $makeIndexCounter);
Expand All @@ -27,7 +27,7 @@ use constant DEBUG => 0; # toggle me
sub init {
($currentWeb, $currentTopic) = @_;

$mixedAlphaNum = TWiki::Func::getRegularExpression('mixedAlphaNum');
$mixedAlphaNum = $Foswiki::regex{'mixedAlphaNum'};
%seenAnchorNames = ();
$makeIndexCounter = 0;
}
Expand All @@ -45,7 +45,7 @@ sub handleFilterArea {
$theAttributes ||= '';
#writeDebug("called handleFilterArea($theAttributes)");

my %params = TWiki::Func::extractParameters($theAttributes);
my %params = Foswiki::Func::extractParameters($theAttributes);
return handleFilter(\%params, $theMode, $theText);
}

Expand Down Expand Up @@ -95,15 +95,15 @@ sub handleFilter {
if ($theText) { # direct text
$text = $theText;
} else { # topic text
$text = &TWiki::Func::readTopicText($theWeb, $theTopic);
$text = &Foswiki::Func::readTopicText($theWeb, $theTopic);
if ($text =~ /^No permission to read topic/) {
return showError("$text");
}
if ($text =~ /%STARTINCLUDE%(.*)%STOPINCLUDE%/gs) {
$text = $1;
if ($theExpand eq 'on') {
$text = &TWiki::Func::expandCommonVariables($text, $currentTopic, $currentWeb);
$text = &TWiki::Func::renderText($text, $currentWeb);
$text = &Foswiki::Func::expandCommonVariables($text, $currentTopic, $currentWeb);
$text = &Foswiki::Func::renderText($text, $currentWeb);
}
}
}
Expand Down Expand Up @@ -213,7 +213,7 @@ sub handleFilter {
}
$result = $theNullFormat unless $result;
$result = $theHeader.$result.$theFooter;
$result = &TWiki::Func::expandCommonVariables($result, $currentTopic, $currentWeb)
$result = &Foswiki::Func::expandCommonVariables($result, $currentTopic, $currentWeb)
if expandVariables($result);

#writeDebug("result='$result'");
Expand Down Expand Up @@ -263,7 +263,7 @@ sub handleMakeIndex {
$maxCols = 1 if $maxCols < 1;

# compute the list
$theList = &TWiki::Func::expandCommonVariables($theList, $theTopic, $theWeb)
$theList = &Foswiki::Func::expandCommonVariables($theList, $theTopic, $theWeb)
if expandVariables($theList);

#writeDebug("theList=$theList");
Expand Down Expand Up @@ -471,7 +471,7 @@ sub handleMakeIndex {
expandVariables($theHeader, count=>$listSize, anchors=>$anchors);
expandVariables($theFooter, count=>$listSize, anchors=>$anchors);

$result = &TWiki::Func::expandCommonVariables(
$result = &Foswiki::Func::expandCommonVariables(
"<div class='fltMakeIndexWrapper'>".
$theHeader.$result.$theFooter .
"</div>",$theTopic, $theWeb);
Expand Down Expand Up @@ -509,7 +509,7 @@ sub handleFormatList {

$theSeparator = ', ' unless defined $theSeparator;

$theList = &TWiki::Func::expandCommonVariables($theList, $theTopic, $theWeb)
$theList = &Foswiki::Func::expandCommonVariables($theList, $theTopic, $theWeb)
if expandVariables($theList);

#writeDebug("theList='$theList'");
Expand Down Expand Up @@ -593,7 +593,7 @@ sub handleFormatList {

my $result = $theHeader.join($theSeparator, @result).$theFooter;
$result =~ s/\$count/$count/g;
$result = &TWiki::Func::expandCommonVariables($result, $theTopic, $theWeb)
$result = &Foswiki::Func::expandCommonVariables($result, $theTopic, $theWeb)
if expandVariables($result);

#writeDebug("result=$result");
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions lib/Foswiki/Plugins/FilterPlugin/MANIFEST
@@ -0,0 +1,4 @@
data/System/FilterPlugin.txt 0644
lib/Foswiki/Plugins/FilterPlugin/Core.pm 0644
lib/Foswiki/Plugins/FilterPlugin.pm 0644
pub/System/FilterPlugin/wikiringlogo40x40.png 0644
File renamed without changes.
4 changes: 0 additions & 4 deletions lib/TWiki/Plugins/FilterPlugin/MANIFEST

This file was deleted.

0 comments on commit c033b7a

Please sign in to comment.