[pmwiki-users] TextExtract (Search recipe) update

Hans design5 at softflow.co.uk
Fri Oct 2 01:27:06 CDT 2009


Friday, October 2, 2009, 12:09:30 AM, ABClf wrote:

> My purpose here is to test if one can use TextExtract in place of
> conventional Include with something like 
> (:pagelist .* regex=1 fmt=extract page=*.*#section#sectionend :)

> On some pages I have an anchored todo section enclosed like this :

> [[#afaire]
> *one
> *two
> [[#finafaire]]


> Then, I would like to use TextExtract new capabilities to extract
> all text enclosed between the anchors [[#afaire]] & [[#finafaire]].
> Here there are my tests and my trouble : 
> ...............
> (:pagelist .* regex=1 fmt=extract page=Argot.*#afaire#finafaire name=-Afaire count=10:)

The problem here is  parameter count=10
Without count=10 it should work fine.

'page=Argot.*#afaire#finafaire count=10'
will cause MakePageList() to make a list of page names
same as name=Argot.* and return the first 10.
Then TextExtract will use that list and look for the text from the
anchored section specified. But there may be no anchored section
in these ten pages. So we get an error "No Matches!"

Basically pagelist does not understand adding #afaire#finafaire
to page names. I added it as a feature to TextExtract, for uses like
your example, but you should not use count= with it.

I have not tried to implement the copunt= parameter for the case
of page names with sections. If it is important I can try.

Side note:
page= is not  a standard pagelist parameter, but fmt=extract
understands it and adds it to name= , TextExtract uses page=
in (:extract :) search form to prevent  a page field.

Another thing:
.* regex=1 will give you all text highlighted.
. regex=1 will give you all text, but not highlighted.
Instead of the last you can alos just use a dot .
and not specify regex=1, it will be automatcally set if the pattern
input is a single dot '.'

  ~Hans




More information about the pmwiki-users mailing list