[pmwiki-users] Wiki Stub detection

Comit sam at usamedia.tv
Fri Feb 17 17:22:28 CST 2006


Woot, works like a charm :D
*toils away at removing the manually written stub note on 86 articles* >_<

Nice script though, you should add it to the website maybe.

- Com | wiki.swcity.net


"Patrick R. Michaud" <pmichaud at pobox.com> wrote in message 
news:20060217224048.GA24481 at host.pmichaud.com...
> On Thu, Feb 16, 2006 at 10:13:22PM -0800, Comit wrote:
>> Would it possible, using the conditional markups + groupfooter, to write 
>> a
>> markup that can detect if there's less than, say, 5 lines in an article, 
>> and
>> if true, print a sentence that basically says it's a stub article?
>
> The following adds an "(:if stub:)" conditional:
>
>    function IsStub($pagename) {
>      $p = ReadPage($pagename, READPAGE_CURRENT);
>      return substr_count($p['text'], "\n") < 5;
>    }
>
>    $Conditions['stub'] = "IsStub(\$pagename)";
>
> With this enabled, you can do:
>
>    (:if stub:)
>    This is a page stub.
>    (:if:)
>
> and it will display the contents if the current page has fewer than
> five lines of markup.   (Note that "current page" is the page
> being displayed, which might not be the same as the page containing
> the (:if stub:) markup.)
>
> Pm 







More information about the pmwiki-users mailing list