]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/wc.mdwn
ikiwiki (3.20130711) unstable; urgency=low
[ikiwiki.git] / doc / plugins / contrib / wc.mdwn
1 [[!template id=plugin name=wc author="[[schmonz]]"]]
2 [[!template id=gitbranch branch=schmonz/wc author="[[schmonz]]"]]
3 [[!tag type/meta]]
4 [[!tag patch]]
5
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]].
9
10 If [[!cpan HTML::Strip]] is installed, the wordcount will be slightly
11 more accurate.
12
13 Possible enhancements:
14
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()`
22   to see.)