[pmwiki-users] ZAP search and replace...

The Editor editor at fast.st
Fri Jan 26 17:18:31 CST 2007


On 1/26/07, Hans <design5 at softflow.co.uk> wrote:
> Friday, January 26, 2007, 9:50:59 PM, The wrote:
>
> > Basically, Replace allows you to find and replace text throughout your
> > entire site (or on specific pages or groups) at the click of a button.
>
> > To use it to do something like FOX, just put an invisible marker on
> > the target page, like [==] or whatever else you want.  Then to append,
> > simply replace "[==]" with "[==]New Text". Or, to prepend text,
> > replace "[==]" with "New Text[==]". But this is just one application
> > of replace. It can do quite a bit more...
>
> very promising! Does it replace multilines?

To be honest, haven't tested for multiple lines, but it should as long
as it matches the actual page markup... When I get a chance I'll check
into it (over the weekend if I can).  Or give it a whirl yourself
using a textbox for output and see what happens...

> Your example snippet does not allow multiline text.
> But you would need that in order to produce something like
> comment posting on a single page.

Yes, that's true.  I was aiming for a multi-purpose solution.  But I
do need to make sure it can do something like this (FOX was a great
inspiration for this). I'm also contemplating the value of allow
pattern matching instead of just simple string replacement...

> The method of using an (invisible) marker to append/prepend
> would work if the replace action would add it automatically/unseen to
> the user submitting.

Yes, that can be done quite easily using zap's field replacements.
Thanks for the encouraging input...

Cheers,
Dan

PS.  Here's all there is to the form on the site:

(:messages:)
(:zapform:)
Find: (:input text in "":)  Replace: (:input text out "":)
(:input select name=replacepage '' 'Select one...':)
(:input select name=replacepage 'Replace.Test1' 'Test1':)
(:input select name=replacepage 'Replace.Test2' 'Test2':)
(:input select name=replacepage 'Replace.Test3' 'Test3':)
(:input select name=replacepage 'group=Replace' 'Entire Group':)
(:zap replace="{in}|{out}" replace:)
(:input submit:)
(:zapend:)

replacepage can also take 'Site' for entire wiki

I tried this snippet just now and got some INTERESTING effects...
Will have to test some more to see just how much this little thing can
do.

(:messages:)
(:zapform:)
(:input textarea out:)
(:zap replace="hi|hi{out}":)
(:zap replacepage="Test.Test2":)
(:input submit:)
(:zapend:)

(:include Test.Test2:)



More information about the pmwiki-users mailing list