Recent Changes - Search:




Summary: Debugging Markup Ruleset
Version: 25 January 2006
Prerequisites: Requires at least PmWiki version: 2.0beta28 (may work on earlier versions); last tested on PmWiki version: 2.0beta28
Maintainer: Joachim Durchholz
Categories: MarkupWriting


Markup issues are often difficult to resolve. This has many reasons:

  • Information on the exact regular expression used to identify the markup is often nonexistent, or listed by example.
  • Markups are substituted sequentially. If a markup emits text that looks like another markup, it will be recognized if the new markup is processed later in the sequence, and passed through unchanged if that markup was already done. Finding the right place to insert the markup can be tricky. (See CustomMarkup.)


Copy ruletable.phpΔ to your cookbook/ directory.

In local/config.php, add the following lines:

  if (IsEnabled($EnableDiag,0) && $action == 'ruletable') {
    include_once ('cookbook/ruletable.php');


Call up the URL http://path/to/wiki/pmwiki.php?action=ruletable.

By default, all columns will be shown. If you wish to see only a specific set of columns, add the string ?column,column,... (no blanks allowed here).
The list of available columns is taken directly from the internal data structures. The most useful ones are pat and rep (these specify the pattern to be searched for, and what it's to be replaced with). seq is used to establish the order in which rules are applied. The remaining fields are for internal use, i.e. mostly interesting to Pm when he's debugging the markup rule engine.

If you find the column display too wide, add ?columnwidth=<number>, where <number> is any valid HTML width specification such as 100px or 10em (again, no blanks allowed).


The script generates CSS style tags that define the ways how various types of values (arrays, strings, nulls, etc.) are displayed.

The CSS styles used are:

.type_unsetNot set in PHP (i.e. PHP's NULL value).
.type_nullSQL NULL value.
.type_resourceAn external resource (file handle etc.).
.type_syntaxDelimiters (such as commas between array elements).
.type_boolTrue and False values.
.type_scalarA scalar (number or string).
.type_controlcodeA control code within a string.
.type_unkownSome PHP type that ruletable.php doesn't know about. (This Should Not Happen.)

Note that there is no provision for configuring the styles in config.php - it would definitely be preferrable over editing the PHP code that generates the styles which is the current method, but I didn't have the nerve to implement it.


See Also


Change History

2006-01-25Fixed PHP5 incompatibility.
2005-04-15Made column and width settings configurable via URL (in the query string).
 Available column names now taken from PmWiki variable, not from hardcoded list.
 Improvements for control code handling: catches all nonprinting codes, and makes them their own CSS class now.
2005-04-03Initial revision.


See discussion at MarkupRulesetDebugging-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.

Edit - History - Print - Recent Changes - Search
Page last modified on October 29, 2013, at 11:13 PM