GWicke has uploaded a new change for review.
https://gerrit.wikimedia.org/r/71857
Change subject: Bug 50426: Strip ./ from wiki link targets
......................................................................
Bug 50426: Strip ./ from wiki link targets
We emitted these with multiple ./ prefixes. While technically correct, this
triggered VE bug 50428. By stripping these prefixes on the way out we should
avoid this issue and generally produce cleaner output.
Also added a test to ensure these links keep working and round-trip fine.
Change-Id: I804695f9fd64eb90a61d372bce2abe1f95104179
---
M js/lib/ext.core.LinkHandler.js
M js/tests/parserTests.txt
2 files changed, 21 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid
refs/changes/57/71857/1
diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index d79360c..6e8c4fa 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -70,6 +70,10 @@
href = info.href;
}
+ // strip ./ prefixes
+ href = href.replace(/^(?:.\/)+/, '');
+ info.href = href;
+
var hrefBits = href.match(/^([^:]+):(.+)$/);
href = env.normalizeTitle( href, false, true );
if ( hrefBits ) {
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index 9333020..cac3663 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -8526,6 +8526,23 @@
<p><a rel="mw:WikiLink"
href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
!! end
+# TODO: make this PHP-parser compatible!
+!! test
+Parsoid: dot-slash prefixed wikilinks
+!! options
+parsoid=wt2wt,wt2html,html2html
+!!input
+[[./foo]]
+
+[[././bar]]
+
+[[././baz/]]
+!! result
+<p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
+<p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
+<p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
+!! end
+
!! test
Disabled subpages
!! input
--
To view, visit https://gerrit.wikimedia.org/r/71857
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I804695f9fd64eb90a61d372bce2abe1f95104179
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits