<div class="gmail_quote">On Fri, Feb 6, 2009 at 8:33 PM, Scott Diegel <span dir="ltr">&lt;<a href="mailto:scottdiegel@gmail.com">scottdiegel@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I want a Markup() call to apply only to a given type of page, specifically if (:sop:) is included on a wiki page. &nbsp;The Markup will affect section numbering, but I still need the standard section markup to be used.<div><div>
<div><div></div></div></div></div></blockquote><div>... <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div><div><div>Loading the file in which this is defined via config.php results in the section formatting being changed for all pages. &nbsp;I tried the following, and checked using ?action=ruleset whether the &#39;sop&#39; rule was being applied; &#39;sopheaders&#39; is being applied, but &#39;sop&#39; is not.</div>

<div><br></div><div><span style="font-family: &#39;courier new&#39;,monospace;">/*</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">function SOPheaders(){</span></div>
<div><span style="white-space: pre;"><span style="font-family: &#39;courier new&#39;,monospace;">        </span></span><span style="font-family: &#39;courier new&#39;,monospace;">Markup(&#39;sop&#39;,&#39;&gt;include&#39;,&#39;/^(!{2,4})(?:\s*)(.*)$/e&#39;, &quot;MkSopNumTitle(strlen(&#39;$1&#39;),PSS(&#39;$2&#39;))&quot;);</span></div>

<div><span style="white-space: pre;"><span style="font-family: &#39;courier new&#39;,monospace;">        </span></span><span style="font-family: &#39;courier new&#39;,monospace;">}</span></div>
<div><span style="font-family: &#39;courier new&#39;,monospace;">Markup(&#39;sopheaders&#39;,&#39;directives&#39;,&#39;/\\(:sop:\\)/e&#39;,&quot;SOPheaders()&quot;);</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">*/</span></div>

<br></div><div>Is this the right approach? &nbsp;Is there another approach I can try?</div><div></div></div></div></blockquote><div><br>That looks fine to me.&nbsp; And if SOPheaders is always active but sop only active on the appropriate pages then that&#39;s exactly what you want, right?&nbsp; My only concern is whether a markup that gets defined *during* markup will get applied correctly (i.e., will it get put in the right order, etc. -- is all that done inside the Markup() function or is it done separately in pmwiki.php after config.php).&nbsp; I&#39;d say if it works then you&#39;ve got a great solution.<br>
<br>If, on the other hand, it&#39;s not working then this is what I would suggest:<br><br><div><span style="font-family: &#39;courier new&#39;,monospace;">function </span><span style="font-family: &#39;courier new&#39;,monospace;">MkSopNumTitle</span><span style="font-family: &#39;courier new&#39;,monospace;">($arg1, $arg2, $MakeMeActive=false){</span></div>

<div><span style="white-space: pre;"><span style="font-family: &#39;courier new&#39;,monospace;">        static $MarkupActive = false;<br><br>    if ($MakeMeActive) {<br>        $MarkupActive = true;<br>        return(true);<br>
    }<br>    if (!$MarkupActive) return;<br><br></span></span><span style="font-family: &#39;courier new&#39;,monospace;"></span></div>
<div><span style="white-space: pre;"><span style="font-family: &#39;courier new&#39;,monospace;"></span></span><span style="font-family: &#39;courier new&#39;,monospace;"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... /* the rest of the code for MkSopNumTitle */<br>
}<br></div>
<div><div><span style="white-space: pre;"><span style="font-family: &#39;courier new&#39;,monospace;"></span></span><span style="font-family: &#39;courier new&#39;,monospace;">Markup(&#39;sop&#39;,&#39;&gt;include&#39;,&#39;/^(!{2,4})(?:\s*)(.*)$/e&#39;, &quot;MkSopNumTitle(strlen(&#39;$1&#39;),PSS(&#39;$2&#39;))&quot;);</span></div>


<div><span style="white-space: pre;"><span style="font-family: &#39;courier new&#39;,monospace;"></span></span></div><span style="font-family: &#39;courier new&#39;,monospace;">Markup(&#39;sopheaders&#39;,&#39;directives&#39;,&#39;/\\(:sop:\\)/e&#39;,&quot;</span><span style="font-family: &#39;courier new&#39;,monospace;">MkSopNumTitle(false, false, true)</span><span style="font-family: &#39;courier new&#39;,monospace;">&quot;);</span></div>
<br>However, your rule-based solution is superior as long as it actually works.&nbsp; It&#39;s better to not even have a rule to process when you don&#39;t need it...<br><br>-Peter <br></div></div>