urllink',"/@\\b($GroupPattern([\\/.]))?($WikiWordPattern)/e", "Keep(WikiLink(\$pagename,'$1'.'$3'),'L')"); ## bare wikilinks with spaced wikiwords Markup('wikilink','>@wikilink',"/\\b($GroupPattern([\\/.]))?($WikiWordPattern)/e", "Keep(WikiLinkSpaced(\$pagename,'$0'),'L')"); $SpaceWikiWords = 1; $AsSpacedFunction = 'ULAsSpaced'; $SpaceWikiWordsFunction = 'SpaceWikiWords'; $MakePageNameFunction = 'MakeULPageName'; $RecentChangesFmt = array( 'Main.AllRecentChanges' => '* [[$Group.$Title]] . . . $CurrentTime by $AuthorLink', '$Group.RecentChanges' => '* [[$Group/$Title]] . . . $CurrentTime by $AuthorLink'); $DefaultPageTextFmt = 'Describe [[$Group/$Title]] here.'; $DefaultName = 'Home_Page'; $AltDefaultName = 'HomePage'; Markup('${DN}','<${var}','/{\$(DefaultName)}/e',"ULAsSpaced(\$GLOBALS['$1'])"); $DefaultPage = "$DefaultGroup.$AltDefaultName"; $PagePathFmt = array('$Group.$1','$Group.$2', '$1.$1','$2.$1','$2.$2', '$1.$DefaultName','$2.$DefaultName', '$1.$AltDefaultName'); $FPLByGroupIFmt = "
\$Title
"; $StopList = array( 'A', 'An', 'And', 'But', 'By', 'For', 'From', 'In', 'Is', 'It', 'Of', 'On', 'Or', 'The', 'To', ); $UnspacedList = array( 'Mac ', 'Pm Wiki', 'Side Bar' ); function ULAsSpaced($text) { return str_replace('_',' ',$text); } function SpaceWikiWords($text) { global $StopList,$UnspacedList; $text = preg_replace('/([[:lower:]])([[:upper:]\\d])/','$1 $2',$text); $text = preg_replace('/([[:upper:]\\d])([[:upper:]][[:lower:]\\d])/', '$1 $2',$text); foreach((array)$StopList as $s) $text = preg_replace("/(\\s$s\\s)/e","strtolower('$1')",$text); foreach((array)$UnspacedList as $u) $text = str_replace($u,str_replace(' ','',$u),$text); return $text; } function MakeULPageName($basepage,$x) { global $PageNameChars,$PagePathFmt; SDV($PageNameChars,'-[:alnum:]'); if (!preg_match('/(?:([^.\\/]+)[.\\/])?([^.\\/]+)$/',$x,$m)) return ''; $name=ucfirst(str_replace(' ','_',trim(preg_replace("/[^$PageNameChars]+/",' ',$m[2])))); $altname=str_replace(' ','', preg_replace('/\\b(\\w)/e',"strtoupper('$1')", str_replace('_',' ',$name))); if ($m[1]) { $group = str_replace(' ','', preg_replace('/\\b(\\w)/e',"strtoupper('$1')", preg_replace("/[^$PageNameChars]+/",' ',$m[1]))); $pn = "$group.$altname"; if (PageExists($pn)) return $pn; return "$group.$name"; } foreach((array)$PagePathFmt as $pg) { $pn = FmtPageName(str_replace('$1',$name, str_replace('$2',$altname,$pg)),$basepage); if (PageExists($pn)) return $pn; } $group=preg_replace('/[\\/.].*$/','',$basepage); return "$group.$name"; } function WikiLinkSpaced($pagename,$word) { global $AsSpacedFunction,$SpaceWikiWordsFunction; $oAsSpacedFunction = $AsSpacedFunction; $AsSpacedFunction = $SpaceWikiWordsFunction; $r = WikiLink($pagename,$word); $AsSpacedFunction = $oAsSpacedFunction; return $r; } ?>