create new tag
, view all tags

FilterPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on FilterPlugin 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

Discussion forum for the FilterPlugin

This stuff has been externalized from the NatSkinPlugin.

-- MichaelDaum - 22 Aug 2005

Thanks Michael for contributing yet another Plugin smile

I made some minor changes to the Plugins topic. Feel free to take this into the next release.

How about measuring and documenting the PluginBenchmarks?

-- PeterThoeny - 23 Aug 2005

Peter, why not extract the plugin author from the plugin info table. Isn't this extra signature redundant?

-- MichaelDaum - 23 Aug 2005

Imported to SVN 6379

-- MichaelDaum - 15 Sep 2005

Please consider adding the use strict; pragma to this plugin. Its use is important to ensuring the quality of TWiki plugins and avoiding unpleasant surprises. See UseStrict for more.

-- MeredithLesly - 02 Jul 2006

This is one example of an invisible problem when use strict; is not used.

"my" variable $item masks earlier declaration in same scope at .../twiki/lib/TWiki/Plugins/FilterPlugin.pm line 209.

-- JacekZapotoczny - 31 Jul 2006

When I read the "documentation" of this plugin then I really have a huge doubt what the different parts of it does. The descriptions are extremely brief.

This plugin deserves a much better plugin topic that describes properly what each tag actually does.

Maybe if I read the code I will figure out but why should you have to???

-- KennethLavrsen - 19 Jan 2007

Is there a possibility to substitute text (from formfield) in search results?

I've tried to substitute text from formfield like shown below but it does not work.

%STARTSUBST{pattern="\| "$'FORMFIELD{Status}'='Available'" \|" format="| :-) |" expand="off" }%
%STARTSUBST{pattern="\| "$'FORMFIELD{Status}'='Borrowed'" \|" format="| :-) |" expand="off" }%--> 

%TABLE{ sort="on" }%
| *Title* | *Author* | *Storage location* | *Borrower* | *Borrow date* | *Status* |
%SEARCH{"ItemType.*value\=.*book\"" scope="text" topic="LibraryItem*" excludetopic="LibraryTemplate" regex="on" nosearch="on" casesensitive="on" format="| [[$topic][ __$formfield(Title)__ ]] | $formfield(Author) | $formfield(Location) | $formfield(Borrower) | $formfield(BorrowDate) | $formfield(Status) | "}%


-- AnnaPapierz - 10 May 2007

The simple solution is the best. Below shown solution works.

%STARTSUBST{pattern="Available" format=" :-) " expand="off" }%
%STARTSUBST{pattern="Borrowed" format=" :-) " expand="off" }%

%TABLE{ sort="on" }%
| *Title* | *Author* | *Storage location* | *Borrower* | *Borrow date* | *Status* |
%SEARCH{"ItemType.*value\=.*book\"" scope="text" topic="LibraryItem*" excludetopic="LibraryTemplate" regex="on" nosearch="on" casesensitive="on" format="| [[$topic][ __$formfield(Title)__ ]] | $formfield(Author) | $formfield(Location) | $formfield(Borrower) | $formfield(BorrowDate) | $formfield(Status) | "}%


-- AnnaPapierz - 11 May 2007

NB The MAKEINDEX example actually requires the GluePlugin in order to render correctly though this dependency is not mentioned (yet). smile

Also, there seems to be a problem with the ExternalLinkPlugin (at least with TWiki 4.2.0); if the latter is enabled, each entry if followed by <img src= (URI, alternate description, and the closing greater-than sign are missing).

-- MarkusUeberall - 24 Jan 2008

Did you post that on ExternalLinkPluginDev?

-- MichaelDaum - 25 Jan 2008

No, because I thought that ExternalLinkPlugin works as it should (external links are displayed correctly anywhere else but within the MAKEINDEX example, cf. the introductory "compare with Philosophy articles needing attention[->]"). Maybe I shouldn't have inserted a newline above to make it clear that IMHO both issues are directly related to MAKEINDEX, sorry. wink

Update: I looked into this and found out that the problem was related to the way options (in this case, format) are parsed. As double quotes are used as delimiters, this clashes with the default definition of MARK used in ExternalLinkPlugin to modifiy external links, which also uses double quotes for the <img> tag. Once you substitute the latter with single quotes, it works flawlessly. In other words, both plugins work as they should; in order to ged rid of this kind of "side effect" for sure, we'd either need some kind of unique delimiter for options or be able to delay the modification of option values, though both of this would obviously not be plugin-specific. (I posted this on ExternalLinkPluginDev as well)

-- MarkusUeberall - 25 Jan 2008 / 31 Jan 2008

Great idea for a plugin. One question- why are you using the /i modifier on the match statement (in sub handleFilter, line 154)? If I try a pattern like:

pattern="([A-Z][a-z0-9]+?)([A-Z][a-z0-9]+)" format="$1 $2"

then input like FooBar gets returned as "Fo oBar", not "Foo Bar" as one might expect.

I would think that case insensitive matching should be optional (i.e. provide a parameter to select this or not).

-- SeanMcCarthy - 06 Oct 2008

True. Removed the /i modifier. I tried your example using

%EXTRACT{text="FooBar" pattern="([A-Z][a-z0-9]+?)([A-Z][a-z0-9]+)" format="$1 $2"}%

Works as expected.

-- MichaelDaum - 07 Oct 2008

I have reworked the examples section of the plugin's home topic. As per the instruction in the HTML comment of that page, I have created TWikibug:Item6085 with the content.

But for some reason I keep getting a timeout when I try to upload the screenshot it refers to. So I'm attaching it here instead, as SimulatedMAKEINDEX.png

-- SeanCMorgan - 20 Oct 2008

Sean, great. Feel free to check in your changes. Thanks so much.

-- MichaelDaum - 23 Oct 2008

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng SimulatedMAKEINDEX.png r1 manage 26.4 K 2008-10-20 - 18:06 SeanCMorgan Screenshot of sample MAKEINDEX output
Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r17 - 2008-10-23 - 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-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.