00798: Enable underscore (_) in page names for sub-page emulation

Summary: Enable underscore (_) in page names for sub-page emulation
Created: 2006-09-02 20:46
Status: Closed - already available
Category: Feature
From: bachmo
Priority: 5
Version: 2.1.14

Description: A relatively straightforward workaround for sub-pages would be to allow pages with an underscore (_) in the name. Then we can easily tie together pages that belong together, such as mypage, mypage_sub1, mypage_sub2, etc. Pagelists can filter on the underscore, enabling automatic listing of pages and their sub-pages. Unfortunately, the current version appears to remove underscores from page names. Can this be readily changed?

Here's how to effectively make subpages. Use a unique character string to separate the parent page from the child page. For example, you can name a page ParentQzqChild. The Qzq characters separate the parent from the child. It would be much better to use underscore (_), but that character gets stripped by pmwiki.

Here's how to make a list of the subpages of a page.

 (:pagelist group={$Group} fmt=#title name={$Name}Qzq* :)

Here's how to exclude the subpages from a page list.

 (:pagelist group={$Group} fmt=#title name=-*Qzq* :)

The capability to enable underscores in pagenames already exists -- simply set the following in local/config.php:

    $PageNameChars = '-\\w';

This says to allow hyphens, letters, digits, and underscores in pagenames.

PmWiki doesn't allow underscores by default because we may be reserving them for future use to indicate spaces in page names.