protected function Markdown::_doLists_callback in Markdown 7
* List parsing callback *
Parameters
array $matches: * @return string
File
- includes/
Markdown.php, line 1065
Class
- Markdown
- Markdown Parser Class
Namespace
MichelfCode
protected function _doLists_callback($matches) {
// Re-usable patterns to match list item bullets and number markers:
$marker_ul_re = '[*+-]';
$marker_ol_re = '\\d+[\\.]';
$marker_any_re = "(?:{$marker_ul_re}|{$marker_ol_re})";
$marker_ol_start_re = '[0-9]+';
$list = $matches[1];
$list_type = preg_match("/{$marker_ul_re}/", $matches[4]) ? "ul" : "ol";
$marker_any_re = $list_type == "ul" ? $marker_ul_re : $marker_ol_re;
$list .= "\n";
$result = $this
->processListItems($list, $marker_any_re);
$ol_start = 1;
if ($this->enhanced_ordered_list) {
// Get the start number for ordered list.
if ($list_type == 'ol') {
$ol_start_array = array();
$ol_start_check = preg_match("/{$marker_ol_start_re}/", $matches[4], $ol_start_array);
if ($ol_start_check) {
$ol_start = $ol_start_array[0];
}
}
}
if ($ol_start > 1 && $list_type == 'ol') {
$result = $this
->hashBlock("<{$list_type} start=\"{$ol_start}\">\n" . $result . "</{$list_type}>");
}
else {
$result = $this
->hashBlock("<{$list_type}>\n" . $result . "</{$list_type}>");
}
return "\n" . $result . "\n\n";
}