CountGlyphs

(redirected from StefCTDemo.RandomCookbookPage)

Summary: A replacement for some of PmWiki's typographical wiki markup
Version: 20260716
Prerequisites: 2.2.58
Status: Stable
Maintainer: Petko (originally written by Pm)
Discussion: CountGlyphs-Talk
Categories: Markup, PHP55, PHP72, PHP85

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 1592 glyphs and 259 words, where

{$Glyphs} - Reports the number of glyphs on this page: 1592
{$Words} - Reports the number of words on this page: 259

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:

  • 20260716: Update to recommended format without evaluation for PmWiki 2.7.0 (should still work with earlier versions). Make the Glyphs work correctly with UTF-8 enabled.
  • 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.