| @@ 37-47 (lines=11) @@ | ||
| 34 | return [['text', $text[0] . $text[1]], 2]; |
|
| 35 | } |
|
| 36 | ||
| 37 | if ($marker == '*' && preg_match('/^[*]{2}((?:[^*]|[*][^*]*[*])+?)[*]{2}(?![*]{2})/s', $text, $matches) || |
|
| 38 | $marker == '_' && preg_match('/^__((?:[^_]|_[^_]*_)+?)__(?!__)/us', $text, $matches)) { |
|
| 39 | ||
| 40 | return [ |
|
| 41 | [ |
|
| 42 | 'strong', |
|
| 43 | $this->parseInline($matches[1]), |
|
| 44 | ], |
|
| 45 | strlen($matches[0]) |
|
| 46 | ]; |
|
| 47 | } |
|
| 48 | } else { // emph |
|
| 49 | // work around a PHP bug that crashes with a segfault on too much regex backtrack |
|
| 50 | // check whether the end marker exists in the text |
|
| @@ 57-66 (lines=10) @@ | ||
| 54 | return [['text', $text[0]], 1]; |
|
| 55 | } |
|
| 56 | ||
| 57 | if ($marker == '*' && preg_match('/^[*]((?:[^*]|[*][*][^*]+?[*][*])+?)[*](?![*][^*])/s', $text, $matches) || |
|
| 58 | $marker == '_' && preg_match('/^_((?:[^_]|__[^_]*__)+?)_(?!_[^_])\b/us', $text, $matches)) { |
|
| 59 | return [ |
|
| 60 | [ |
|
| 61 | 'emph', |
|
| 62 | $this->parseInline($matches[1]), |
|
| 63 | ], |
|
| 64 | strlen($matches[0]) |
|
| 65 | ]; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | return [['text', $text[0]], 1]; |
|
| 69 | } |
|