This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Description: This file is intended to be used as a "cookbook" extension to pmwiki 2, and is used to provided spacing in the display of WikiWords. Usage: Put the following line in your local/config.php file include_once("cookbook/spaced.php"); To display spaced out WikiWord text in your skins template use the following mark-up in the .tmpl file where [WikiWord] is replaced with the text you want to space out. usually this will be some global/configuraiton variable like $PageTitle or $Group ************************************************************************ */ /* Function to space out wiki words input: wikiWord:: string with WikiWord returned: spaced Wiki Word */ function SpaceWikiWord($wikiWord) { return preg_replace( array("/_/", "/([[:upper:]]\d*)([[:upper:]][[:lower:]])/", "/([[:lower:]]\d*)([[:upper:]])/"), array(" ", "\$1 \$2", "\$1 \$2", "\$1 \$2"), $wikiWord); } /* Function to be called as part of mark-up for WikiWord parsing it is a wrapper for MakeLink Input: pageName: (passed on to MakeLink) wikiWord: the WikiWord to be linked and displayed spaced Returned: result of MakeLink */ function MakeWikiLink($pageName, $wikiWord) { $txt = preg_replace('/\\([^)]*\\)/','',$wikiWord); $txt = preg_replace('/^[^\\/]*\\//','',$txt); $txt = SpaceWikiWord($txt); return MakeLink($pageName, $wikiWord, $txt); } /* Space out wiki words for templates. Takes the standard parameters for pmwiki page template function the template format to envoke this function is input: fullName:: full name of the current wiki page as in Group.PageName wikiWord:: WikiWord to be spaced out output: spaced WikiWord echoed directly into the page flow (returning this doesn't work???) */ function TmplSpacedWikiWord($fullName, $wikiWord) { echo SpaceWikiWord($wikiWord); } /* Call Markup to put spaced wikilink markup into mark-up database. This will superceed the standard mark-up for WikiWord links */ Markup('wikilink', '>urllink', "/\\b($GroupPattern([\\/.]))?($WikiWordPattern)/e", "Keep(MakeWikiLink(\$pagename,'$0'),'L')"); ?>