Subversion Repositories Applications.papyrus

Rev

Rev 556 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 556 Rev 954
Line 32... Line 32...
32
*/
32
*/
33
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup!
33
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup!
Line 34... Line 34...
34
 
34
 
35
if (!function_exists("wakka2callback"))
35
if (!function_exists("wakka2callback"))
36
{
-
 
37
	include("formatters/tableaux.php");	//EF => tableaux
36
{
38
	function wakka2callback($things)
37
	function wakka2callback($things)
39
	{
38
	{
40
		$thing = $things[1];
39
		$thing = $things[1];
Line 52... Line 51...
52
		// convert HTML thingies
51
		// convert HTML thingies
53
		if ($thing == "<")
52
		if ($thing == "<")
54
			return "&lt;";
53
			return "&lt;";
55
		else if ($thing == ">")
54
		else if ($thing == ">")
56
			return "&gt;";
55
			return "&gt;";
57
		//EF=> tableaux
-
 
58
		else if (preg_match("/^\[\|(.*)\|\]/s", $thing))
-
 
59
		{
-
 
60
			return parsetable($thing);
-
 
61
		}	//end tableaux
-
 
62
		// bold
56
		// bold
63
		else if ($thing == "**")
57
		else if ($thing == "**")
64
		{
58
		{
65
			static $bold = 0;
59
			static $bold = 0;
66
			return (++$bold % 2 ? "<b>" : "</b>");
60
			return (++$bold % 2 ? "<b>" : "</b>");
Line 186... Line 180...
186
			}
180
			}
187
		}
181
		}
188
		// forced links
182
		// forced links
189
		// \S : any character that is not a whitespace character
183
		// \S : any character that is not a whitespace character
190
		// \s : any whitespace character
184
		// \s : any whitespace character
191
		else if (preg_match("/^\[\[(\S*)\s+(.+)?\]\]$/", $thing, $matches))
185
		else if (preg_match("/^\[\[(\S*)(\s+(.+))?\]\]$/", $thing, $matches))
192
		{
186
		{
193
			list (, $url, $text) = $matches;
187
			list (, $url, $text) = $matches;
194
			if ($url)
188
			if ($url)
195
			{
189
			{
196
				if ($url!=($url=(preg_replace("/@@|££|\[\[/","",$url))))$result="</span>";
190
				if ($url!=($url=(preg_replace("/@@|££|\[\[/","",$url))))$result="</span>";
Line 318... Line 312...
318
 
312
 
319
$text = str_replace("\r", "", $text);
313
$text = str_replace("\r", "", $text);
320
$text = chop($text)."\n";
314
$text = chop($text)."\n";
321
$text = preg_replace_callback(
315
$text = preg_replace_callback(
322
	"/(\%\%.*?\%\%|".
-
 
323
	"^\[\|.*?\|\]|".	//EF => tableaux
316
	"/(\%\%.*?\%\%|".
324
	"\"\".*?\"\"|".
317
	"\"\".*?\"\"|".
325
	"\[\[.*?\]\]|".
318
	"\[\[.*?\]\]|".
326
	"\b[a-z]+:\/\/\S+|".
319
	"\b[a-z]+:\/\/\S+|".
327
	"\*\*|\#\#|@@|££|__|<|>|\/\/|".
320
	"\*\*|\#\#|@@|££|__|<|>|\/\/|".