<div dir="ltr">Thanks Peter. So helpful.<div style>I have been reading about regular expressions. I am wondering why we need "\\" in the pattern <span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"> </span><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">'/\\(:plant\\s*(.*?):\\)/e'? I know that "\(" means the "(" character, but what does "\\(" mean? The extra "\" is also used before "\s" and "\)". Is that part of pmwiki?</span></div>
<div style><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">-Mark</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 8, 2013 at 7:47 AM, Peter Bowers <span dir="ltr"><<a href="mailto:pbowers@pobox.com" target="_blank">pbowers@pobox.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 8, 2013 at 4:23 PM, Mark Lee <span dir="ltr"><<a href="mailto:mark.lee.phd@gmail.com" target="_blank">mark.lee.phd@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>The X and Y position of the plant on the map is contained on the page. Lets say a tree is located at map coordinates <100,250>. I was thinking to use the markup (:xposition 100:) (:yposition 250). I could then use this information in what ever way is supported by pmwiki markup via {$:xposition} and {$:yposition}.</div>



<div>5. In html, I am able to place a marker using styles. For example, if I want a marker "1" at position <132,165> I use <<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">plant style="position:relative; left:132px; top:165px">2</plant></p>. Is this possible in pmwiki?</span></div>


</blockquote></div><br></div></div><div class="gmail_extra">Just set up your (:plant ...:) custom markup so that it produces this HTML...<br><br>Something like this:<br><br></div><div class="gmail_extra">(:plant 2 x=100 y=250:)<br>


<br></div><div class="gmail_extra">See <a href="http://www.pmwiki.org/wiki/PmWiki/CustomMarkup" target="_blank">http://www.pmwiki.org/wiki/PmWiki/CustomMarkup</a> or <a href="http://www.pmwiki.org/wiki/PmWiki/CustomMarkupAlt" target="_blank">http://www.pmwiki.org/wiki/PmWiki/CustomMarkupAlt</a> to see how to create your own markup.  You will also want to take a look at <a href="http://www.pmwiki.org/wiki/Cookbook/ParseArgs" target="_blank">http://www.pmwiki.org/wiki/Cookbook/ParseArgs</a> to handle the arguments nicely.<br>


<br></div><div class="gmail_extra">To get a quick idea of what it'll look like, here's a very slightly tested chunk of code that may be somewhat close to what you want:<br><br>===(snip)===<br>Markup('plant', 'directives',<br>


  '/\\(:plant\\s*(.*?):\\)/e',<br>  'Plant($pagename, "$1")');<br><br>function Plant($pagename, $args)<br>{<br><br>   $opts = ParseArgs($args);<br>   echo "opts=".print_r($opts,true)."<br />\n";<br>


<br>   $x = (@$opts['x'] ? $opts['x'] : 0);<br>   $y = (@$opts['y'] ? $opts['y'] : 0);<br>   $num = (@$opts['num'] ? $opts['num'] : 'Unnumbered');<br><br>   $out = "<plant style=\"position: relative; left: ${x}px; top: ${y}px\">$num</plant>";<br>


<br>   return Keep($out);<br>}<br>===(snip)===<br><br>That should get the basic idea -- you can get more elegant using positional parameters with ParseArgs or something, but this should be a good start.<span class="HOEnZb"><font color="#888888"><br>
</font></span></div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra">

<br></div><div class="gmail_extra">-Peter<br></div></font></span></div>
</blockquote></div><br></div>