Could arguments in shortcuts allow brackets? #976
-
Currently the regex's at markdown.php:3879-3880 do not allow brackets (more exactly: closing brackets) in the arguments of shortcuts. This is hardly relevant for most extensions, but is a serious drawback for Math, since brackets are an important part of mathematical syntax. After different experiments, I thought of the following solution: brackets could be allowed in an argument if enclosed in quotes. This would require only different regex's: $text = preg_replace_callback("/^\s*\[(\w+)((?:\s+(?:[^\]\"\s]+|\"(?:[^\"]|\"\"|\\\\\")*\"))*\s*)\]\s*$/", array($this, "_doAutoLinks_shortcutBlock_callback"), $text);
$text = preg_replace_callback("/\[(\w+)((?:\s+(?:[^\]\"\s]+|\"(?:[^\"]|\"\"|\\\\\")*\"))*\s*)\]/", array($this, "_doAutoLinks_shortcutInline_callback"), $text); The regex, even if it seems complicated, is actually straigthforward. It states that after the name of the extensions Unless I miss something (very possible 😁), this solution would negatively affect in no way any extension, since the parsing of the arguments (by means of Actually this is my fourth attempt at solving this issue:
Sorry for the long message! What do you think about that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No, it's better to use URL encoding or character entity. |
Beta Was this translation helpful? Give feedback.
No, it's better to use URL encoding or character entity.