Cookbook /
CountGlyphs
Summary: A replacement for some of PmWiki's typographical wiki markup
Version: 20170801
Prerequisites: 2.2.58
Status: Stable
Discussion: CountGlyphs-Talk
Question
Is there a markup that will tell me the number of characters or words on a page?
Answer
The countglyphs.phpΔ script adds {$Glyphs}
and {$Words}
markups, which are replaced with the number of glyphs (non-whitespace characters) and words respectively. The algorithm excludes any HTML output from the count, as well as anything produced by the page's headers and footers (i.e., it counts only the wiki markup output).
Example
This page contains 1563 glyphs and 230 words, where
{$Glyphs}
- Reports the number of glyphs on this page: 1563
{$Words}
- Reports the number of words on this page: 230
Notes and Comments
- This recipe was last tested on PmWiki version: 2.2.101
- This recipe requires at least PmWiki version: 2.2.58
Release Notes
Changes by Petko
- 20170801: update for PHP 5.5 and 7.2
- 20111015: fixed PHP warning in recent versions.
See Also
Contributors
- Pm, 2005-Mar-25
- BenWilson, 2006-May-19 Corrected for v2.1.5
- Petko is the current maintainer of the recipe
Comments
See discussion at CountGlyphs-Talk
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.