[pmwiki-devel] WordCount Recipe.

Patrick R. Michaud pmichaud at pobox.com
Tue Oct 31 09:34:11 CST 2006


On Tue, Oct 31, 2006 at 04:53:24AM -0500, Stirling Westrup wrote:
> I've just finished a word count recipe for NaNoWriMo. Its intended to
> replace the existing countglyphs recipe. The major improvements are:
> 
>   1) It creates pagevars that support the {Group.Page$Words} syntax.
>   2) It can be easily extended to count other entities than words or
>      glyphs.
>   3) It can save the generated counts as page attributes.
> 
> My big question right now is: did I do this right? 

Having looked at it only briefly, I'd say it's done "right",
at least as far as 2.1 is concerned.

However, I'm thinking that PmWiki's internal handling of page 
properties may change soon in 2.2 (to make things such as this
much simpler), so I wouldn't completely rely on the current 
implementation.

Also, the recipe seems to count words in the markup, whereas
the original CountGlyphs recipe counted the only the words in
the output.  That might be a somewhat significant difference.

> I don't /think/ it would be too much
> of a burden to calculate a word and/or glyph count on every save, but
> all my sites are tiny so I've no experience on what might be burdensome
> on the larger sites.

You're correct, it wouldn't be too much of a burden to count words
on every save.  It's certainly less of a burden than doing it on
every read.  

Pm



More information about the pmwiki-devel mailing list