TTO has uploaded a new change for review. https://gerrit.wikimedia.org/r/255919
Change subject: Handle links with multiple pipes correctly in edit summaries ...................................................................... Handle links with multiple pipes correctly in edit summaries Bug: T99346 Change-Id: I459b0027c7703b2379e024d88fab74b17ebb11e9 --- M includes/Linker.php M tests/parser/parserTests.txt 2 files changed, 27 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/19/255919/1 diff --git a/includes/Linker.php b/includes/Linker.php index 842d276..f07c24f 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1410,10 +1410,10 @@ :? # ignore optional leading colon ([^\]|]+) # 1. link target; page names cannot include ] or | (?:\| - # 2. a pipe-separated substring; only the last is captured - # Stop matching at | and ]] without relying on backtracking. - ((?:]?[^\]|])*+) - )* + # 2. link text + # Stop matching at ]] without relying on backtracking. + ((?:]?[^\]])*+) + )? \]\] ([^[]*) # 3. link trail (the text up until the next link) /x', diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 58860e9..c2dbfdf 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -20191,21 +20191,13 @@ !! end !! test -Anchor starting with underscore +Edit comment with link with more than one pipe (T99346) +!! options +comment !! wikitext -[[#_ref|One]] +[[Main Page|Many|pipes]] !! html -<p><a href="#_ref">One</a> -</p> -!! end - -!! test -Id starting with underscore -!! wikitext -<div id="_ref"></div> -!! html -<div id="_ref"></div> - +<a href="/wiki/Main_Page" title="Main Page">Many|pipes</a> !! end !! test @@ -20229,6 +20221,24 @@ <a href="/index.php?title=ABC3D%25_%2B%2B&action=edit&redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&action=edit&redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a> !! end +!! test +Anchor starting with underscore +!! wikitext +[[#_ref|One]] +!! html +<p><a href="#_ref">One</a> +</p> +!! end + +!! test +Id starting with underscore +!! wikitext +<div id="_ref"></div> +!! html +<div id="_ref"></div> + +!! end + # Parsoid doesn't support this yet: see bug 73581 # but it *should* omit the 'src' attribute if the image is bad. # PHP side of tests was disabled in -- To view, visit https://gerrit.wikimedia.org/r/255919 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I459b0027c7703b2379e024d88fab74b17ebb11e9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: TTO <at.li...@live.com.au> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits