Subversion Repositories Applications.papyrus

Rev

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

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