mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
markdown: Handle multiple python regex capture groups properly.
Since on replacing the first 'P<>' group, we remove this text from the string, we have to make the RegExp start looking from index 0 again to properly convert later 'P<>' groups to JS regex syntax.
This commit is contained in:
@@ -519,6 +519,11 @@ run_test('python_to_js_filter', () => {
|
||||
var actual_value = marked.InlineLexer.rules.zulip.realm_filters;
|
||||
var expected_value = [/\/aa\/g(?![\w])/gim, /\/aa\/g(?![\w])/g];
|
||||
assert.deepEqual(actual_value, expected_value);
|
||||
// Test case with multiple replacements.
|
||||
markdown.set_realm_filters([['#cf(?P<contest>[0-9]+)(?P<problem>[A-Z][0-9A-Z]*)', 'http://google.com']]);
|
||||
actual_value = marked.InlineLexer.rules.zulip.realm_filters;
|
||||
expected_value = [/#cf([0-9]+)([A-Z][0-9A-Z]*)(?![\w])/g];
|
||||
assert.deepEqual(actual_value, expected_value);
|
||||
});
|
||||
|
||||
run_test('katex_throws_unexpected_exceptions', () => {
|
||||
|
||||
Reference in New Issue
Block a user