<div>I've managed to get the result I want by editing the return value of MkSopNumTitle based on whether or not "(:sop:)" was found. I still think it seems reasonable to allow "Markup()" in a "Markup()".</div>
<div><br></div><div>Scott</div><div><br></div><br><br><div class="gmail_quote">On Mon, Feb 9, 2009 at 9:56 AM, Scott Diegel <span dir="ltr"><<a href="mailto:scottdiegel@gmail.com">scottdiegel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Peter, thanks for the reply. Unfortunately, your method doesn't seem to work quite correctly either. The method you specified (and several variations on it that I tried) works for suppressing the "sop" markup on pages that don't have "(:sop:)" specified, but it removes all sectioning on the pages on which "(:sop:)" is specified.</div>
<div><br></div><div>It still seems to me that the most straightforward and sensible way to do this is to allow a "Markup()" call within a "Markup()" call, but that doesn't seem to work.</div><div>
<br></div><div>So I'm still banging my head over this one.</div><div><br></div><font color="#888888"><div>Scott</div></font><div><div></div><div class="Wj3C7c"><div> </div><br><br><div class="gmail_quote">On Sat, Feb 7, 2009 at 9:30 AM, Peter Bowers <span dir="ltr"><<a href="mailto:pbowers@pobox.com" target="_blank">pbowers@pobox.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div>On Fri, Feb 6, 2009 at 8:33 PM, Scott Diegel <span dir="ltr"><<a href="mailto:scottdiegel@gmail.com" target="_blank">scottdiegel@gmail.com</a>></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. 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><div>... <br></div><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. I tried the following, and checked using ?action=ruleset whether the 'sop' rule was being applied; 'sopheaders' is being applied, but 'sop' is not.</div>
<div><br></div><div><span style="font-family:'courier new',monospace">/*</span></div><div><span style="font-family:'courier new',monospace">function SOPheaders(){</span></div>
<div><span style="white-space:pre"><span style="font-family:'courier new',monospace">        </span></span><span style="font-family:'courier new',monospace">Markup('sop','>include','/^(!{2,4})(?:\s*)(.*)$/e', "MkSopNumTitle(strlen('$1'),PSS('$2'))");</span></div>
<div><span style="white-space:pre"><span style="font-family:'courier new',monospace">        </span></span><span style="font-family:'courier new',monospace">}</span></div>
<div><span style="font-family:'courier new',monospace">Markup('sopheaders','directives','/\\(:sop:\\)/e',"SOPheaders()");</span></div><div><span style="font-family:'courier new',monospace">*/</span></div>
<br></div><div>Is this the right approach? Is there another approach I can try?</div><div></div></div></div></blockquote></div><div><br>That looks fine to me. And if SOPheaders is always active but sop only active on the appropriate pages then that's exactly what you want, right? 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). I'd say if it works then you've got a great solution.<br>
<br>If, on the other hand, it's not working then this is what I would suggest:<br><br><div><span style="font-family:'courier new',monospace">function </span><span style="font-family:'courier new',monospace">MkSopNumTitle</span><span style="font-family:'courier new',monospace">($arg1, $arg2, $MakeMeActive=false){</span></div>
<div><span style="white-space:pre"><span style="font-family:'courier new',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:'courier new',monospace"></span></div>
<div><span style="white-space:pre"><span style="font-family:'courier new',monospace"></span></span><span style="font-family:'courier new',monospace"></span> ... /* the rest of the code for MkSopNumTitle */<br>
}<br></div>
<div><div><div><span style="white-space:pre"><span style="font-family:'courier new',monospace"></span></span><span style="font-family:'courier new',monospace">Markup('sop','>include','/^(!{2,4})(?:\s*)(.*)$/e', "MkSopNumTitle(strlen('$1'),PSS('$2'))");</span></div>
<div><span style="white-space:pre"><span style="font-family:'courier new',monospace"></span></span></div></div><span style="font-family:'courier new',monospace">Markup('sopheaders','directives','/\\(:sop:\\)/e',"</span><span style="font-family:'courier new',monospace">MkSopNumTitle(false, false, true)</span><span style="font-family:'courier new',monospace">");</span></div>
<br>However, your rule-based solution is superior as long as it actually works. It's better to not even have a rule to process when you don't need it...<br><br>-Peter <br></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>