<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>wordcount (third party plugin)</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="../../style.css" type="text/css" /> <link rel="stylesheet" href="../../local.css" type="text/css" /> </head> <body> <div class="page"> <div class="pageheader"> <div class="header"> <span> <span class="parentlinks"> <a href="../../index.html">ikiwiki</a>/ <a href="../../plugins.html">plugins</a>/ <a href="../contrib.html">contrib</a>/ </span> <span class="title"> wordcount (third party plugin) </span> </span> </div> </div> <div id="pagebody"> <div id="content" role="main"> <p><span class="infobox"> Plugin: wordcount<br /> Author: <span class="createlink">schmonz</span><br /> Included in ikiwiki: no<br /> Enabled by default: no<br /> Included in <a href="../goodstuff.html">goodstuff</a>: no<br /> Currently enabled: no<br /> </span></p> <div class="infobox"> Available in a <a href="../../git.html">git</a> repository <a href="../../branches.html">branch</a>.<br /> Branch: schmonz/wordcount<br /> Author: <span class="createlink">schmonz</span><br /> </div> <p>This plugin counts words in a page. For a single page, write a <code>[[!wordcount ]]</code> directive and the word count will be interpolated there. For a site, add <code><TMPL_VAR WORDCOUNT></code> to your <a href="../../templates.html">templates</a>.</p> <p>If <a href="http://search.cpan.org/search?mode=dist&query=HTML%3A%3AStrip">HTML::Strip</a> is installed, the wordcount will be slightly more accurate.</p> <p>Possible enhancements:</p> <ul> <li>Optimize: count words iff the result will be displayed. <code>sanitize()</code> seems like the right place to count. Since it's called well after <code>preprocess()</code>, I can tell whether a directive needs the result, but since it appears to be called before <code>pagetemplate()</code>, I can't tell whether a template wants to know and possibly skip the computation. (In other words, if I add <code>$needed_for_template</code> like <code>$needed_for_directive</code>, it gets set too late for <code>sanitize()</code> to see.)</li> </ul> </div> </div> <div id="footer" class="pagefooter" role="contentinfo"> <div id="pageinfo"> <div class="tags"> Tags: <a href="../../branches.html" rel="tag">branches</a> <a href="../../git.html" rel="tag">git</a> <a href="../../patch.html" rel="tag">patch</a> <a href="../type/meta.html" rel="tag">type/meta</a> </div> <div class="pagedate"> Last edited <span class="date">Tue Feb 26 23:01:54 2019</span> <!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> --> </div> </div> <!-- from ikiwiki --> </div> </div> </body> </html>