@@ 543-553 (lines=11) @@ | ||
540 | // Fenced code block marker: find matching end marker. |
|
541 | $fence_indent = strlen($capture[1]); // use captured indent in re |
|
542 | $fence_re = $capture[2]; // use captured fence in re |
|
543 | if (preg_match('{^(?>.*\n)*?[ ]{' . ($fence_indent) . '}' . $fence_re . '[ ]*(?:\n|$)}', $text, |
|
544 | $matches)) |
|
545 | { |
|
546 | // End marker found: pass text unchanged until marker. |
|
547 | $parsed .= $tag . $matches[0]; |
|
548 | $text = substr($text, strlen($matches[0])); |
|
549 | } |
|
550 | else { |
|
551 | // No end marker: just skip it. |
|
552 | $parsed .= $tag; |
|
553 | } |
|
554 | } |
|
555 | // Check for: Indented code block. |
|
556 | else if ($tag[0] === "\n" || $tag[0] === " ") { |
|
@@ 566-576 (lines=11) @@ | ||
563 | else if ($tag[0] === "`") { |
|
564 | // Find corresponding end marker. |
|
565 | $tag_re = preg_quote($tag); |
|
566 | if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)' . $tag_re . '(?!`)}', |
|
567 | $text, $matches)) |
|
568 | { |
|
569 | // End marker found: pass text unchanged until marker. |
|
570 | $parsed .= $tag . $matches[0]; |
|
571 | $text = substr($text, strlen($matches[0])); |
|
572 | } |
|
573 | else { |
|
574 | // Unmatched marker: just skip it. |
|
575 | $parsed .= $tag; |
|
576 | } |
|
577 | } |
|
578 | // Check for: Opening Block level tag or |
|
579 | // Opening Context Block tag (like ins and del) |