[Pmwiki-users] Conflict in wikilog calendar module and [[include:PageName#start#end]]
Patrick R. Michaud
pmichaud
Thu May 20 11:16:06 CDT 2004
FYI, for those who have been having trouble getting the
[[include:PageName#start#end]] syntax to work properly, the problem
may be coming from an undesirable interaction with the wikilog calendar
script. Line 16 of freesupport.php (in wikilog) sets $PageTitlePattern to
$PageTitlePattern = "$TitlePattern(-$AnyLetter+)*(~$TitlePattern)?";
and the parens throw off the capturing subpattern sequence that the
[[include:]] processor needs. The fix seems to be to simply add ?: to
the parentheses to prevent them from capturing, thus line 16 should read:
$PageTitlePattern = "$TitlePattern(?:-$AnyLetter+)*(?:~$TitlePattern)?";
Since I'm not the maintainer for the wikilog module I'll let someone else
post an "official" fix to the cookbook. In the meantime, I'm attaching
my patched version of freesupport.php to this message.
Many thanks to Thomas Counsell for helping me to locate/fix this problem.
Pm
-------------- next part --------------
<?php
/*
This controls addition of free link functionality, to make sure parsing
happens in the correct order.
Copyright 2003, 2004 John Rankin john.rankin at affinity.co.nz
*/
$AnyLetter = "[A-Za-z0-9]";
$PageNameSpace = "";
#$PageNameSpace = "_";
#$TitleWord = "[A-Z0-9]($AnyLetter*)(-($AnyLetter+))*";
#$PageTitlePattern = "($TitleWord)(_($TitleWord))*";
$TitlePattern = "[A-Z0-9]$AnyLetter*";
$PageTitlePattern = "$TitlePattern(?:-$AnyLetter+)*(?:~$TitlePattern)?";
$PageNamePattern = "($GroupNamePattern)([.\\/])($PageTitlePattern)";
$GroupFreeLinkPattern="{{(?>(?:($GroupNamePattern)([.\\/]))?([[:alnum:]]+(?:(?:[\\s_]*|[-~])[[:alnum:]]+)*)(?:\\|((?:(?:[\\s_]*|[-~])[[:alnum:]])*))?)}}((?:-?[[:alnum:]]+)*)";
$FreeLinkPattern = $GroupFreeLinkPattern;
$ClassicFreeLinkPattern="{{($AnyLetter+(?:(?:\s*|[-~])$AnyLetter+)*)(?:\\|((?:(?:\s*|[-~])$AnyLetter)*))?}}((-?$AnyLetter)*)";
$GroupLinkPattern = "(($GroupNamePattern)([.\\/]))?($ClassicFreeLinkPattern)";
$PageLinkPattern =
"($PageNamePattern)|($GroupLinkPattern)|($WikiWordPattern)";
function Wikify($word) {
global $PageNameSpace;
$linktext = preg_replace("/{{(.*)}}.*/","$1",str_replace("|","",$word));
return preg_replace("/\s+/",$PageNameSpace,ucwords($linktext));
}
function QualifyLink($thisgroup,$link) {
if (preg_match("/[.\\/]/",$link)) { return $link; }
else { return "$thisgroup/$link"; }
}
?>
More information about the pmwiki-users
mailing list