[Pmwiki-users] Maximum <h6>

Patrick R. Michaud pmichaud
Fri Jan 30 09:47:52 CST 2004


On Fri, Jan 30, 2004 at 04:03:02PM +0100, Thomas -Balu- Walter wrote:
> Just a minor thing I've just added to pmwiki.php at about line 786 
> to avoid people creating <h13> with using many '!'s
> 
> $h="h".(strlen($match[1])<=6 ? strlen($match[1]) : '6');

Nice catch--I hadn't even considered this.  I'll fix this in the
main pmwiki.php script in the next release, but instead of the fix you've 
proposed (which is fine, btw) I'll probably change the previous line from

       } elseif (preg_match("/^(!+)/",$x,$match)) {

to

       } elseif (preg_match("/^(!{1,6})/",$x,$match)) {

to match anywhere from 1-6 exclamation points.  If someone does
put extra !'s in the line then they don't just inexplicably disappear
with no effect.

> I've done that, because I have structured my page using the header-tags:
>         <h1> is the main page title
>         <h2> is subtitle and to structure the page for not CSS-Browsers
>              (CSS-Browsers use display:none)
> So the Wiki-Headers should start using <h3>:
> [...]
> Any idea how to avoid making the above change (+2) in the pmwiki.php
> file directly? I guess that's not possible right now, is it?

Actually, it is, although it's a bit sneaky.  :-)  Try

   $DoubleBrackets['/^!/'] = '!!!'; 

in local.php.  This will automatically add '!!' to the beginning of
any line beginning with '!'.

Pm



More information about the pmwiki-users mailing list