Peter,
I have copied your files Test.LocCode and Test.Loc1, Test.Loc2 and
Test.Loc3 to my site. I copied the wikish command to a new page
Plants.Plant001. I changed the grep source as shown below.
{(wikish echo "|| border=1"; grep '\(:location.*x=.*y=' Plants.Plant? | sed
-e 's/^/||/' -e 's/:\(:/||/' -e 's/ x=/||/' -e 's/ y=/||y=/' -e
's/:\).*$/||/';)}I get the error WikiSh.Read: Unable to read Plants.Plant?. Does not exist. Sorry for the newbie question, but what is the syntax error? Another question... I am able to set a single variable equal to a line selected with grep using the set command in wikish. Is there a way to parse the variable and to push results into a set of arrays. For example, each location line has a x= and y= value, and I would like to push x and y values into separate arrays like I do in php. Is this something that can be done with functions in wikish? -Mark On Tue, May 28, 2013 at 11:39 PM, Mark Lee <[email protected]> wrote: > Thank you Peter! Amazing. That example is so helpful. I'm glad I found > pmwiki. > -Mark > > > On Tue, May 28, 2013 at 11:14 PM, Peter Bowers <[email protected]> wrote: > >> On Tue, May 28, 2013 at 9:32 PM, Mark Lee <[email protected]> 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 >> function? >> >> 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. >> >> -Peter >> > >
_______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users
