protected function Markdown::parseSpan in Markdown 7
* Take the string $str and parse it into tokens, hashing embeded HTML, * escaped characters and handling code spans. *
Parameters
string $str: * @return string
1 call to Markdown::parseSpan()
- MarkdownExtra::_doTable_callback in includes/
MarkdownExtra.php - * Calback for processing tables *
File
- includes/
Markdown.php, line 1725
Class
- Markdown
- Markdown Parser Class
Namespace
MichelfCode
protected function parseSpan($str) {
$output = '';
$span_re = '{
(
\\\\' . $this->escape_chars_re . '
|
(?<![`\\\\])
`+ # code span marker
' . ($this->no_markup ? '' : '
|
<!-- .*? --> # comment
|
<\\?.*?\\?> | <%.*?%> # processing instruction
|
<[!$]?[-a-zA-Z0-9:_]+ # regular tags
(?>
\\s
(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*
)?
>
|
<[-a-zA-Z0-9:_]+\\s*/> # xml-style empty tag
|
</[-a-zA-Z0-9:_]+\\s*> # closing tag
') . '
)
}xs';
while (1) {
// Each loop iteration seach for either the next tag, the next
// openning code span marker, or the next escaped character.
// Each token is then passed to handleSpanToken.
$parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE);
// Create token from text preceding tag.
if ($parts[0] != "") {
$output .= $parts[0];
}
// Check if we reach the end.
if (isset($parts[1])) {
$output .= $this
->handleSpanToken($parts[1], $parts[2]);
$str = $parts[2];
}
else {
break;
}
}
return $output;
}