[pmwiki-users] Help for designing a new ptv pattern <<< my new multiline ptv pattern >>>

ABClf languefrancaise at gmail.com
Sun Jan 18 04:32:12 CST 2015


Thank you Hans for your help ;
easy enough to write and sounds a smart idea to treat anchor as ptv without
the need to define a new markup. And at least strongly distinctive. That's
in my config now and soon in doc.

For complete information, can you explain how your code let ptv visible, as
compared to the original code which makes ptv invisible ?

your code :
"/(\\[\\[#(\\w[-\\w]*)\\]\\](?: *\n)?)(.*?)(\\[\\[#\\2end\\]\\])/s";
vs original code :
'/\\(: *(\\w[-\\w]*) *:(?!\\))\\s?(.*?):\\)/s'));

2015-01-18 10:10 GMT+01:00 Hans Bracker <design at softflow.co.uk>:

> PS:
>
> one could define anchored sections as PTVs.
>
> Add to config.php:
>
> # make it possible to treat [[#section]] .... [[#sectionend]] as a PTV of
> name 'section'
> $PageTextVarPatterns['[[#anchor]]'] =
>   "/(\\[\\[#(\\w[-\\w]*)\\]\\](?: *\n)?)(.*?)(\\[\\[#\\2end\\]\\])/s";
>
>
> then any section of form
>
> [[#section]]
> your text
> goes here..
> ..
> ..
> ....
> [[#sectionend]]
>
> is a PTV with name 'section'. Put in your choosen anchor name instead.
> Note  the  syntax  of  the  ending  anchorname:  PTV-name  with  'end'
> appended.  Anchor  names  must  start  with  a letter, but can contain
> numbers and underscores.
>
> The  advantage  of  using  anchors as PTVs is that you could reference
> those  sections  as PTVs and also as anchor sections, use them in urls
> for  instance.  The markers are also invisible.  But they maybe not as
> easy to write as what you hope.
>
> Best,
>  Hans
>
>


-- 

---------------------------------------
| A | de la langue française
| B | http://www.languefrancaise.net
| C | languefrancaise at gmail.com
---------------------------------------
       @bobmonamour
---------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20150118/3fb8c1a0/attachment.html>


More information about the pmwiki-users mailing list