protected function Markdown::_detab_callback in Markdown 7
* Replace tabs callback *
Parameters
string $matches: * @return string
File
- includes/
Markdown.php, line 1842
Class
- Markdown
- Markdown Parser Class
Namespace
MichelfCode
protected function _detab_callback($matches) {
$line = $matches[0];
$strlen = $this->utf8_strlen;
// strlen function for UTF-8.
// Split in blocks.
$blocks = explode("\t", $line);
// Add each blocks to the line.
$line = $blocks[0];
unset($blocks[0]);
// Do not add first block twice.
foreach ($blocks as $block) {
// Calculate amount of space, insert spaces, insert block.
$amount = $this->tab_width - $strlen($line, 'UTF-8') % $this->tab_width;
$line .= str_repeat(" ", $amount) . $block;
}
return $line;
}