protected function Markdown::handleSpanToken in Markdown 7
* Handle $token provided by parseSpan by determining its nature and * returning the corresponding value that should replace it. *
Parameters
string $token: * @param string &$str * @return string
1 call to Markdown::handleSpanToken()
- Markdown::parseSpan in includes/
Markdown.php - * Take the string $str and parse it into tokens, hashing embeded HTML, * escaped characters and handling code spans. *
File
- includes/
Markdown.php, line 1784
Class
- Markdown
- Markdown Parser Class
Namespace
MichelfCode
protected function handleSpanToken($token, &$str) {
switch ($token[0]) {
case "\\":
return $this
->hashPart("&#" . ord($token[1]) . ";");
case "`":
// Search for end marker in remaining text.
if (preg_match('/^(.*?[^`])' . preg_quote($token) . '(?!`)(.*)$/sm', $str, $matches)) {
$str = $matches[2];
$codespan = $this
->makeCodeSpan($matches[1]);
return $this
->hashPart($codespan);
}
return $token;
// Return as text since no ending marker found.
default:
return $this
->hashPart($token);
}
}