1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 23:11:19 +01:00

Relax markdown parser

This commit is contained in:
Daniil Gentili 2023-07-16 16:07:49 +02:00
parent 1726441d54
commit ee226b54fa
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 12 additions and 2 deletions

View File

@ -9,8 +9,9 @@ Features:
Fixes: Fixes:
- Improved the `markdownEscape` function! - Improved the `markdownEscape` function!
- Translated even more MadelineProto UI elements! - Translated even more MadelineProto UI elements!
- Now the same static analysis rules are applied for both plugins and simple event handlers. - Improve the static analyzer.
- Made some fixes to simple filters. - Made some fixes to simple filters.
- Relax markdown parser.
--- ---

View File

@ -79,7 +79,10 @@ final class MarkdownEntities extends Entities
continue; continue;
} }
if ($next !== '(') { if ($next !== '(') {
throw new AssertionError("( expected @ pos $offset!"); [, $start] = \array_pop($stack);
$message .= '['.$piece.$char;
$messageLen += StrTools::mbStrlen($piece)+2;
continue;
} }
$offset++; $offset++;
$char = "]("; $char = "](";

View File

@ -349,6 +349,12 @@ class EntitiesTest extends MadelineTestCase
], ],
], ],
], ],
[
'markdown',
'[not a link]',
'[not a link]',
[],
],
[ [
'html', 'html',
'<a href="https://google.com/">link </a>test', '<a href="https://google.com/">link </a>test',