1 [[!template id=plugin name=wc author="[[schmonz]]"]]
2 [[!template id=gitbranch branch=schmonz/wc author="[[schmonz]]"]]
6 This plugin counts words in a page. For a single page, write a
7 `\[[!wc]]` directive and the word count will be interpolated there.
8 For a site, add `<TMPL_VAR WORDCOUNT>` to your [[templates]].
10 If [[!cpan HTML::Strip]] is installed, the wordcount will be slightly
13 Possible enhancements:
15 * Optimize: count words iff the result will be displayed. `sanitize()`
16 seems like the right place to count. Since it's called well after
17 `preprocess()`, I can tell whether a directive needs the result,
18 but since it appears to be called before `pagetemplate()`, I can't
19 tell whether a template wants to know and possibly skip the
20 computation. (In other words, if I add `$needed_for_template`
21 like `$needed_for_directive`, it gets set too late for `sanitize()`