<div dir="ltr"><div class="gmail_extra">On Tue, May 28, 2013 at 9:32 PM, Mark Lee <<a href="mailto:mark.lee.phd@gmail.com">mark.lee.phd@gmail.com</a>> wrote:<br>><br>> I am new to wikish. Is it possible to do the following with wikish?<br>
><br>> A subset of pages in a group have this markup on the page.<br>><br>> (:location x=1 y=2:)<br>> (:location x=10 y=10:)<br>> (:location x=20 y=5)<br>> etc...<br>><br>> 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:<br>
><br>> Group:Group1<br>> Pagename=Name1, x=1, y=2<br>> Pagename=Name1, x=10, y=10<br>> Pagename=Name1, x=20, y=5<br>> Pagename=Name6, x=3, y=15<br>> Pagename=Name82, x=5, y=70<br>> Pagename=Name82, x=2, y=40<br>
> etc...<br><br></div><div class="gmail_extra">grep '\(:location.*x=.*y=' Group1.*<br></div><div class="gmail_extra"><br>> 2. Is it possible to format the output as a table?<br><br></div><div class="gmail_extra">
Several ways. Here's one (approximate):<br></div><div class="gmail_extra"><br><div class="gmail_extra">grep 'location.*x=.*y=' Group1.* | sed -e 's/^/||/' -e 's/:\(:/||/' -e 's/ x=/||x=' -e 's/ y=/||y=' -e 's/:\).*$/||'<br>
<br></div><div class="gmail_extra">See <a href="http://pmwiki.qdk.org/pmwiki.php?n=Test.LocCode">http://pmwiki.qdk.org/pmwiki.php?n=Test.LocCode</a> for a working example with 3 pages of test data.<br></div><br>> 3. Is it possible to pipe the result to additional wikish code or a php function?<br>
<br></div><div class="gmail_extra">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.<br>
<br>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 <a href="http://www.pmwiki.org/wiki/Cookbook/MiscMX">http://www.pmwiki.org/wiki/Cookbook/MiscMX</a> for some fairly minimalized examples to work off of.<br>
<br></div><div class="gmail_extra">-Peter<br></div></div>