[pmwiki-users] wikish example please

Peter Bowers pbowers at pobox.com
Wed May 29 01:14:00 CDT 2013

On Tue, May 28, 2013 at 9:32 PM, Mark Lee <mark.lee.phd at gmail.com> wrote:
> I am new to wikish. Is it possible to do the following with wikish?
> A subset of pages in a group have this markup on the page.
> (:location x=1 y=2:)
> (:location x=10 y=10:)
> (:location x=20 y=5)
> etc...
> 1. What is the code for listing out the locations, one per line, along
with the pagenames, excluding all pages without the (:loaction:) markup.
For example:
> Group:Group1
> Pagename=Name1, x=1, y=2
> Pagename=Name1, x=10, y=10
> Pagename=Name1, x=20, y=5
> Pagename=Name6, x=3, y=15
> Pagename=Name82, x=5, y=70
> Pagename=Name82, x=2, y=40
> etc...

grep '\(:location.*x=.*y=' Group1.*

> 2. Is it possible to format the output as a table?

Several ways.  Here's one (approximate):

grep 'location.*x=.*y=' Group1.* | sed -e 's/^/||/' -e 's/:\(:/||/' -e 's/
x=/||x=' -e 's/ y=/||y=' -e 's/:\).*$/||'

See http://pmwiki.qdk.org/pmwiki.php?n=Test.LocCode for a working example
with 3 pages of test data.

> 3. Is it possible to pipe the result to additional wikish code or a php

Always possible to pipe it to additional wikish.  Or put that value in a
wikish variable (or pv or ptv) and then further manipulate it.  Or put it
into Tmp pages (which are available for wikish access and manipulation but
don't exist otherwise).  Or etc.

To mess with it in a php function probably you would want to bind your
function to a markup expression and then pipe data to/from wikish using
standard wikish conventions.  You can look at
http://www.pmwiki.org/wiki/Cookbook/MiscMX for some fairly minimalized
examples to work off of.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130529/abfb299a/attachment.html>

More information about the pmwiki-users mailing list