[pmwiki-devel] Anchors

Simon nzskiwi at gmail.com
Fri Jan 6 21:43:04 CST 2012


I'm looking at stdmarkup.php
## [[#anchor]]
Markup('[[#','<[[','/(?>\\[\\[#([A-Za-z][-.:\\w]*))\\]\\]/e',
  "Keep(TrackAnchors('$1') ? '' : \"<a name='$1' id='$1'></a>\", 'L')");

and http://www.w3.org/TR/html4/types.html#type-name

I'm trying to get an anchor such as
<http://ttc.org.nz/pmwiki/pmwiki.php/TararuaFootprints/MangatainokaValley>
[[#Mangatainoka–Herepai–Ruapae]]
to work, (seems reasonable to me).

I'm not clear about how this regex works, but my studied
<http://www.regular-expressions.info/charclass.html>interpretation is

(?>  ---- no backtrack, but not really clear why () is required
\\[[\\[[#   to  \\]]\\]]     ---- is the scope of the expression (not sure
what /e does)
[A-Za-z] ---- anchor name has to start with A-Za-z, followed by
[-.:\\w] ---- character set of hyphen period colon and "word
character" A-Za-z0-9_, not sure why there is a \\ (escaped \)
* ---- repeat 0 or more times

so it looks like my anchor should work?

any suggestions appreciated

thanks

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20120107/1386095a/attachment.html>


More information about the pmwiki-devel mailing list