aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2013-02-23 14:24:08 -0500
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2013-02-23 14:26:37 -0500
commite823ee4bea481f259369d9d58d2c761eba02aab2 (patch)
tree64e447eba415652874ff00ab5275a2a4288c0dd9
parent59cca91406baca9509c5dabd29a18d22cbd31df3 (diff)
downloadikiwiki-e823ee4bea481f259369d9d58d2c761eba02aab2.tar
ikiwiki-e823ee4bea481f259369d9d58d2c761eba02aab2.tar.gz
Document wc plugin.
-rw-r--r--doc/plugins/contrib/wc.mdwn21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/plugins/contrib/wc.mdwn b/doc/plugins/contrib/wc.mdwn
new file mode 100644
index 000000000..97d501e34
--- /dev/null
+++ b/doc/plugins/contrib/wc.mdwn
@@ -0,0 +1,21 @@
+[[!template id=plugin name=wc author="[[schmonz]]"]]
+[[!template id=gitbranch branch=schmonz/wc author="[[schmonz]]"]]
+[[!tag type/meta]]
+
+This plugin counts words in a page. For a single page, write a
+`\[[!wc]]` directive and the word count will be interpolated there.
+For a site, add `<TMPL_VAR WORDCOUNT>` to your [[templates]].
+
+If [[!cpan HTML::Strip]] is installed, the wordcount will be slightly
+more accurate.
+
+Possible enhancements:
+
+* Optimize: count words iff the result will be displayed. `sanitize()`
+ seems like the right place to count. Since it's called well after
+ `preprocess()`, I can tell whether a directive needs the result,
+ but since it appears to be called before `pagetemplate()`, I can't
+ tell whether a template wants to know and possibly skip the
+ computation. (In other words, if I add `$needed_for_template`
+ like `$needed_for_directive`, it gets set too late for `sanitize()`
+ to see.)