[pmwiki-users] Overwriting <h1> headline markup

Johannes Langlotz johannes at webminster.org
Sun Apr 26 18:52:21 CDT 2009


Patrick R. Michaud wrote:
> On Sun, Apr 26, 2009 at 05:25:39PM +0200, Johannes Langlotz wrote:
>> I want to change the HTML output of <h1> headlines. "! Headline" 
>> currently creates "<h1>Headline</h1>". I want it to create something 
>> like <h1>Headline<div>additional info</div></h1> where "additional info" 
>>   is the content of a wiki page. I tried this:
>>
>> Markup('<h1>!', '<^!',
>>      '/^!{1}\\s?(.*)$/e',
>>      "'<:block,1><h1>'.PSS('$1').'<div>'.PRR(IncludeText(\$pagename, 
>> 'Site.HeadlineInfo')).'</div></h1>'");
>>
>> But this rule seems to be applied to all headlines. How can I restrict 
>> it to the main ("!") headline?
> 
> The pattern  '/^!{1}\\s?(.*)$/e'   will match any line that begins with a !,
> including multiple !'s.
> 
> You probably want:
> 
>     '/^!(?!!)\\s?(.*)$/e'
> 
> Here, the (?!!) means "don't match another ! at this point".

Thanks! I thought !{1} will restrict it to lines with one '!' but like 
you said it will also match multiple '!'. Your rule works like I want it 
to be.

Johannes




More information about the pmwiki-users mailing list