Wiki source for AduC812


Show raw source

I am running a Russian Wikka site: [[http://romantic-ustu.ru/ Tourclub "Romantic" (Турклуб "Романтик")]]

I have added a dozen of available here plugins, some of them I have modified to our needs, and few my own plugins.
The theme is also our own, made from our old WackoWiki template (we have recently migrated from WackoWiki).
The page layout is changed to introduce a main menu shown to the left. (Powered by WikkaMenus)
I an using UTF8 database and the names of pages can be in Russian, for that I had to modify the regexps in the wakka.php formatter as well as in the Wikka.class.php to use a unicode-style letter character classes, such as \pL \p{Lu} and \p{Ll}
Maybe somewhat later I will make a contribution for the project based on my effort.

This is a diff code to add in a 1.3-gettext version a link markup of camelcase WikiNames, plain URLs and interwiki links in unicode, such as ** ВикиИмя **, ** http://кремль.рф ** and ** ВикиПедия:Формат **. For a latter ones to work one should add a desired interwiki header to a [[http://docs.wikkawiki.org/interwiki interwiki list ]]

%%(diff)
--- 1.3_gettext_original/formatters/wakka.php 2010-11-16 19:37:02.000000000 +0200
+++ 1.3_gettext/formatters/wakka.php 2010-11-21 11:02:30.000000000 +0200
@@ -573,7 +573,7 @@
return (++$trigger_center % 2 ? "<div class=\"center\">\n" : "\n</div>\n");
}
// urls (see RFC 1738 <http://www.ietf.org/rfc/rfc1738.txt>)
- elseif (preg_match("/^([a-z]+:\/\/[[:alnum:]\/?;:@&=\.]+[[:alnum:]\/])(.*)$/", $thing, $matches))
+ elseif (preg_match("/^([a-z]+:\/\/[[:alnum:]\p{L}\/?;:@&=\.]+[[:alnum:]\p{L}\/])(.*)$/u", $thing, $matches))
{
$url = $matches[1];
/* Inline images are disabled for security reason, use {{image action}} #142
@@ -788,7 +788,7 @@
// Case 2: Deprecated...(first part is a string
// followed by one or more whitespaces)
else if(preg_match("/^(.*?)\s+([^|]+)$/s", $contents, $matches) &&
- preg_match("/^[A-ZÄÖÜa-zßäöü][A-Za-z0-9ÄÖÜßäöü]*$/", $matches[1]))
+ preg_match("/^[\p{Lu}][\p{L}0-9]*$/u", $matches[1]))
{
$url = $matches[1];
$text = $matches[2];
@@ -984,12 +984,12 @@
}
}
// interwiki links!
- elseif (preg_match("/^[A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:]\S*$/s", $thing))
+ else if (preg_match("/^[\p{Lu}][\p{L}]+[:]\S*$/su", $thing))
{
return $wakka->Link($thing);
}
// wiki links!
- elseif (preg_match("/^[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*$/s", $thing))
+ else if (preg_match("/^[\p{Lu}]+[\p{Ll}]+[\p{Lu}0-9][\p{L}0-9]*$/su", $thing))
{
return $wakka->Link($thing);
}
@@ -1088,8 +1088,8 @@
"\[\[[^\[]*?\]\]|".
# forced linebreak and hr
"-{3,}|".
- # URL
- "\b[a-z]+:\/\/\S+|".
+ # URL - can also be unicode - ADuC812 16.11.2010
+ "(?<!\pL)[\p{Ll}]+:\/\/\S+|".
# Wiki markup
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|££|¥¥|\+\+|__|<|>|\/\/|".
# headings
@@ -1100,15 +1100,15 @@
"\|(?:[^\|])?\|(?:\(.*?\))?(?:\{[^\{\}]*?\})?(?:\n)?|".
# action
"\{\{.*?\}\}|".
- # InterWiki link
- "\b[A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:](?![=_])\S*\b|".
- # CamelWords
- "\b([A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*)\b|".
+ # InterWiki link - can also be unicode - ADuC812 16.11.2010
+ "(?<!\pL)[\p{Lu}][\p{L}]+[:](?![=_])\S*(?!\pL)|".
+ # CamelWords - can also be unicode - ADuC812 16.11.2010
+ "(?<!\pL)([\p{Lu}]+[\p{Ll}]+[\p{Lu}0-9][\p{L}0-9]*)(?!\pL)|".
#ampersands! Track single ampersands or any htmlentity-like (&...;)
'\\&([#a-zA-Z0-9]+;)?|'.
# newline
"\n".
- "/ms", "wakka2callback", $text."\n"); #append \n (#444)
+ "/msu", "wakka2callback", $text."\n"); #append \n (#444) #append /u to enable unicode

// we're cutting the last <br />
$text = preg_replace("/<br \/>$/","", $text);




--- 1.3_gettext_original/libs/Wakka.class.php 2010-11-16 19:37:05.000000000 +0200
+++ 1.3_gettext/libs/Wakka.class.php 2010-11-16 20:20:07.000000000 +0200
@@ -2313,7 +2313,7 @@

// is this an interwiki link?
// before the : should be a WikiName; anything after can be (nearly) anything that's allowed in a URL
- if (preg_match('/^([A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+)[:](\S*)$/', $tag, $matches)) // @@@ FIXME #34 (inconsistent with Formatter)
+ if (preg_match('/^([\p{Lu}_][\p{Lu}\p{Ll}_]+)[:](\S*)$/u', $tag, $matches)) // @@@ FIXME #34 (inconsistent with Formatter)
{
$url = $this->GetInterWikiUrl($matches[1], $matches[2]);
$class = 'interwiki';
%%

ADuC812
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki