Gerrit Patch Uploader has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/392419 )
Change subject: Make mw.text.nowiki() escape "!" at beginning of line ...................................................................... Make mw.text.nowiki() escape "!" at beginning of line Exclamation point "!" is part of the table syntax. Bug: T168763 Change-Id: I6c9dcfdbbb2c6eff9414e24d3f2693ebe576505a --- M engines/LuaCommon/lualib/mw.text.lua M tests/phpunit/engines/LuaCommon/TextLibraryTests.lua 2 files changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto refs/changes/19/392419/1 diff --git a/engines/LuaCommon/lualib/mw.text.lua b/engines/LuaCommon/lualib/mw.text.lua index 0439966..f84bc79 100644 --- a/engines/LuaCommon/lualib/mw.text.lua +++ b/engines/LuaCommon/lualib/mw.text.lua @@ -101,6 +101,7 @@ } local nowikiRepl2 = { + ["\n!"] = "\n!", ["\r!"] = "\r!", ["\n#"] = "\n#", ["\r#"] = "\r#", ["\n*"] = "\n*", ["\r*"] = "\r*", ["\n:"] = "\n:", ["\r:"] = "\r:", @@ -128,7 +129,7 @@ -- string.gsub is safe here, because we're only caring about ASCII chars s = string.gsub( s, '["&\'<=>%[%]{|}]', nowikiRepl1 ) s = '\n' .. s - s = string.gsub( s, '[\r\n][#*:; \n\r\t]', nowikiRepl2 ) + s = string.gsub( s, '[\r\n][!#*:; \n\r\t]', nowikiRepl2 ) s = string.gsub( s, '([\r\n])%-%-%-%-', '%1----' ) s = string.sub( s, 2 ) s = string.gsub( s, '__', '__' ) diff --git a/tests/phpunit/engines/LuaCommon/TextLibraryTests.lua b/tests/phpunit/engines/LuaCommon/TextLibraryTests.lua index 85dd9e3..20fd6ff 100644 --- a/tests/phpunit/engines/LuaCommon/TextLibraryTests.lua +++ b/tests/phpunit/engines/LuaCommon/TextLibraryTests.lua @@ -80,10 +80,10 @@ { name = 'nowiki', func = mw.text.nowiki, - args = { '*"&\'<=>[]{|}#*:;\n*\n#\n:\n;\nhttp://example.com:80/\nRFC 123, ISBN 456' }, + args = { '*"&\'<=>[]{|}#*:;\n!\n#\n*\n:\n;\nhttp://example.com:80/\nRFC 123, ISBN 456' }, expect = { '*"&'<=>[]{|}#*:;' .. - '\n*\n#\n:\n;\nhttp://example.com:80/' .. + '\n!\n#\n*\n:\n;\nhttp://example.com:80/' .. '\nRFC 123, ISBN 456' } }, -- To view, visit https://gerrit.wikimedia.org/r/392419 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6c9dcfdbbb2c6eff9414e24d3f2693ebe576505a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Scribunto Gerrit-Branch: master Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com> Gerrit-Reviewer: Vlakoff <vlak...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits