SpacedWikiWords
Goal
Space out WikiWords in the page presentation without requiring FreeLink? mark-up.
$SpaceWikiWords
and the (:spacewikiwords:)
directive.
Solution
spaced.phpΔ (LarryBaltz September 24, 2004, at 11:13 AM)
Put spaced.php in the PmWiki cookbook/ directory (you may have to create it).
Add the following line to local/config.php:
include_once("cookbook/spaced.php");
Discussion
When using a PmWiki as a website authoring tool, it's often desirable to present page names in a format that doesn't look "wikiish" by spacing out page names represented by WikiWords. Bare WikiWords will generate links to their associated pages, but the link text may appear odd to those unfamiliar with wikis. To address this space can be added between the individual components of a wiki word. This can be accomplished by using FreeLinks and adding the text of the WikiWord spaced out in the link text, but this is a bit tedious when editing (requiring that the page name be entered twice.
To avoid this, this cookbook solution adds code to automatically space out the link text of WikiWord links and provides a function that can be used in PmWiki page layout templates to space out PmWiki global variables holding WikiWord text.
Usage Notes
WikiWord link text is automatically spaced out (for both existing and nonexisting wiki pages). So no specific action is required to make this happen once the spaced.php cookbook file is included in the local config.php file.
To display spaced out WikiWord text in your skins template use the following mark-up in the .tmpl file
<!--function:TmplSpacedWikiWord [WikiWord]-->
where [WikiWord]
is replaced with the text you want to space out.
Usually this will be some global/configuraiton variable like
$PageTitle
or $Group
To space page names in the Group / Name page title, try the following:
- in the template, change the reference to $Name to read $SpacedName
- add the following to local/config.php $SpacedName = SpaceWikiWords(FmtPageName('$Name',$pagename));
That will probably work... - but that don't - PRZ -