[pmwiki-devel] WordCount Recipe.

Stirling Westrup sti at pooq.com
Tue Oct 31 14:39:48 CST 2006


Patrick R. Michaud wrote:
> On Tue, Oct 31, 2006 at 02:35:27PM -0500, Stirling Westrup wrote:
>> Patrick R. Michaud wrote:
>>> On Tue, Oct 31, 2006 at 04:53:24AM -0500, Stirling Westrup wrote:
> 
>>   2) Try to more closely duplicate what countglyphs did. Run the markup
>> text through MarkupToHTML, remove anything enclosed in <...> tags and
>> count that. 
> 
> This will be the way to go, especially since SaveAttributes
> already runs the markup text through MarkupToHTML (and will be
> making the result available to later edit functions).
> In fact, there's the possibility that the rendered text
> (sans HTML tags) will be saved as an attribute to make it easier
> to count words and to display page excerpts (e.g. in pagelists
> and searchresults).
> 
> There's also the bonus that when SaveAttributes runs MarkupToHTML,
> it turns off (:include:), groupheaders, groupfooters, etc.

A few questions then:

1) How do I hook into the results of what SaveAttributes is doing,
without running it twice? I need to do my counting and variable setting
between where it sets $html and where it stores the page attributes.
Should I add an EditFunction just after it in the list and set the page
attributes in $new myself, or should I replace the whole function with a
slightly-modified one that calls a list of update functions in the middle?

2) How do I make sure that variables of the form {OtherPage$Description}
or {OtherPage$:OtherVar} don't get expanded, thus changing the word
count? I could add a pattern to SaveAttrPatterns to eliminate them, but
would that break anything?

3) Should I perhaps just go with what I have now and wait for the
changes of the next few betas before doing any more work on this recipe?



More information about the pmwiki-devel mailing list