From 4e5faf038fc2c106ced4bf619e7c68223b1d102f Mon Sep 17 00:00:00 2001 From: jwbth <33615628+jwbth@users.noreply.github.com> Date: Tue, 17 Nov 2020 18:54:29 +0300 Subject: [PATCH] Fix wrong placement of comments in wikitext This concerns replies to comments whose indentation characters start with "#". For example: https://ru.wikipedia.org/w/index.php?diff=110538343. --- src/js/Comment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/Comment.js b/src/js/Comment.js index 54f49e01..9e359f48 100644 --- a/src/js/Comment.js +++ b/src/js/Comment.js @@ -1790,13 +1790,13 @@ export default class Comment extends CommentSkeleton { // "\n" is here to avoid putting the reply on a casual empty line. "\x01" is from hiding // closed discussions. - '(?![:*#\\n\\x01])' + + `[:*#\\x01]{0,${maxIndentationCharsLength}}(?![:*#\\n\\x01])` + // This excludes the case where "#" is starting a numbered list inside a comment // (https://ru.wikipedia.org/w/index.php?diff=110482717). ( maxIndentationCharsLength > 0 ? - `|[:*#\\x01]{0,${maxIndentationCharsLength}}(?![:*\\n\\x01])` : + `|[:*#\\x01]{1,${maxIndentationCharsLength}}(?![:*\\n\\x01])` : '' ) + ')'