You are here

function Markdown_Parser::_doLists_callback in Markdown 6

Same name and namespace in other branches
  1. 5 markdown.php \Markdown_Parser::_doLists_callback()

File

./markdown.php, line 1026

Class

Markdown_Parser

Code

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})";
  $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);
  $result = $this
    ->hashBlock("<{$list_type}>\n" . $result . "</{$list_type}>");
  return "\n" . $result . "\n\n";
}