Is it possible to use PmWiki with another naming scheme for the pages? For example, instead of CamelCaseNames using underscore_separated_names?
Yes. PmWiki is structured in such a way that it is relatively easy to make very drastic changes to its behavior.
The most popular alternative naming scheme is using underscores to separate the words of page names. But this is not by any means the only possibility. Two solutions are offered here.
First Case (the packaged solution)
Alternative scheme for wikiword spacing, using underscores to represent spaces in page names.
For sites where the administrator wants to set
$SpaceWikiWords to true some common problems arise. For example, those pages are not quite right: War and Peace?, Novell NetWare?, Apple iTunes?, James McGregor?, Community of Practice?. References are fine, but the spaced page names may not be (War And Peace, Novell Net Ware, Apple I Tunes, James Mc Gregor, Community Of Practice). There are 2 issues: inappropriate spacing and inappropriate capitalisation.
This first bundled solution tries to enhance the power of the current AsSpaced function. From an author's perspective, using [[ ... ]] markup gives you the page name you ask for; only the first letter gets capitalised and spacing is preserved as entered. The script implements the following alternative page naming algorithm:
- upshift the first letter (names must start with an upper case letter or number)
- turn spaces into underscores
- an alternate AsSpaced function changes underscores into spaces
- a new SpaceWikiWords function spaces wiki words on entry
- an alternate MakePageName function applies the algorithm to names (the $Name, not the $Group)
- expand the list of likely homonyms in
- use the $Title instead of the $Name in RecentChanges and search results
It is fairly liberal in its treatment of wiki words, looking to see if Wiki_Word and then WikiWord exist. NewPage becomes New_Page by default, but an author can always prevent spaces by writing
[[NewPage]] if appropriate (for example FileMaker?. It sets the
$DefaultName to 'Home_Page' but will still find Main.HomePage correctly.
So, on with the files:
Second case (the freeform way)
The default declaration of said variable is:
$MakePageNamePatterns = array( "/'/" => '', # strip single-quotes "/[^$PageNameChars]+/" => ' ', # convert everything else to space '/((^|[^-\\w])\\w)/' => 'cb_toupper', # capitalize words "/\\s+/" => '_');
Those are regular expressions that are aplied to the text inside [[ ]] freelink markups. You have to change it to suit your ideas of how pages should be named. As you might have noticed, regular expressions are very powerfull, and almost anything could be done this way.
To separate words in pagenames with underscores, you would have to change the last of those 4 rules to:
"/\\s+/" => '_' # Convert spaces to underscores
Thus, Documentation index becomes "Documentation_Index".
The third rule (the one with strtoupper function) is responsible for the automatic up-casing of letters. If you want to upcase only the first letter of the pagename (so that Documentation index becomes "Documentation_index"), you could do:
"/(^\\w)/" => 'cb_toupper', # initial caps
(Beware, if you do NOT uppercase the first letter of your pagenames, the wiki will stop recognizing them as files, and you will need to alter the variables:
$GroupPattern = '[\\w]*(?:-\\w+)*'; $NamePattern = '[\\w]*(?:-\\w+)*';
If the wiki can then do a case-insensitive search for the corresponding page file, this should go a long way.
- ISO8859MakePageNamePatterns - ISO 8859 character conversion for url page names; strip accents etc. from characters for easier readable page names
- Router - Router should make it possible to define your URLs however you like, forwarding on to PmWiki default filenames.
See discussion at AlternateNamingScheme-Talk