| @@ 1925-1935 (lines=11) @@ | ||
| 1922 | if ($tag{0} == "`") { |
|
| 1923 | # Find corresponding end marker. |
|
| 1924 | $tag_re = preg_quote($tag); |
|
| 1925 | if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}', |
|
| 1926 | $text, $matches)) |
|
| 1927 | { |
|
| 1928 | # End marker found: pass text unchanged until marker. |
|
| 1929 | $parsed .= $tag . $matches[0]; |
|
| 1930 | $text = substr($text, strlen($matches[0])); |
|
| 1931 | } |
|
| 1932 | else { |
|
| 1933 | # Unmatched marker: just skip it. |
|
| 1934 | $parsed .= $tag; |
|
| 1935 | } |
|
| 1936 | } |
|
| 1937 | # |
|
| 1938 | # Check for: Indented code block or fenced code block marker. |
|
| @@ 1949-1959 (lines=11) @@ | ||
| 1946 | else { |
|
| 1947 | # Fenced code block marker: find matching end marker. |
|
| 1948 | $tag_re = preg_quote(trim($tag)); |
|
| 1949 | if (preg_match('{^(?>.*\n)+?'.$tag_re.' *\n}', $text, |
|
| 1950 | $matches)) |
|
| 1951 | { |
|
| 1952 | # End marker found: pass text unchanged until marker. |
|
| 1953 | $parsed .= $tag . $matches[0]; |
|
| 1954 | $text = substr($text, strlen($matches[0])); |
|
| 1955 | } |
|
| 1956 | else { |
|
| 1957 | # No end marker: just skip it. |
|
| 1958 | $parsed .= $tag; |
|
| 1959 | } |
|
| 1960 | } |
|
| 1961 | } |
|
| 1962 | # |
|