[pmwiki-users] cookbook "ShellTools" (was: Include specific lines of text on a page)

Hans design5 at softflow.co.uk
Sun Jan 20 13:21:43 CST 2008


Sunday, January 20, 2008, 6:23:57 PM, Peter & Melodye Bowers wrote:

> One final question regarding the use of these MarkupExpressions: How does
> the nesting work?  Let's say I want to "tail" the result of a "grep" -- how
> does that happen?  (I would play with it, but I'm having too much trouble
> with the arguments to be able to figure it out with any confidence...)

Peter, I think nesting does not work well when processing multiple
pages. That was the reason I included into the grep.php script an
option of cut= and hide=, rather than trying to make these into
separate MXPs (markup expressions, is this a usable acronym???).
It is enough processing just to open every page in the file list once.
So I propose to do the same for a tail= option, if that is useful:
tail=n, n being an integer, would display the last n lines from every
page which  matches the wildcard pattern.

But seeing this I think a lines=n option is more friendly and useful:
lines=5 would display the first 5 lines from  every page, and
lines=-5 would display the last 5 lines from every page matching.
This would be similar to the (:include PageName lines=... :) option
(but would work on multiple pages).

Looking again at the (:include ..:) options I realise that in the
grep.php script I lost the ability to source text not just from whole
pages, but from specified sections. I think it would be useful to gain
that too.

What do you think?


  ~Hans




More information about the pmwiki-users mailing list