Created
June 17, 2009 20:32
-
-
Save gaspard/131486 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright: http://textile.thresholdstate.com/ */ | |
function span($text) | |
{ | |
$qtags = array('\*\*','\*','\?\?','-','__','_','%','\+','~','\^'); | |
$pnct = ".,\"'?!;:"; | |
foreach($qtags as $f) { | |
$text = preg_replace_callback("/ | |
(?:^|(?<=[\s>$pnct])|([{[])) | |
($f)(?!$f) | |
({$this->c}) | |
(?::(\S+))? | |
([^\s$f]+|\S[^$f\n]*[^\s$f\n]) | |
([$pnct]*) | |
$f | |
(?:$|([\]}])|(?=[[:punct:]]{1,2}|\s)) | |
/x", array(&$this, "fSpan"), $text); | |
} | |
return $text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment