Subramanya Sastry has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327856 )

Change subject: Code cleanup in MWParserEnvironment.js
......................................................................

Code cleanup in MWParserEnvironment.js

normalizeAndResolvePageTitle was doing duplicate work.
page.title already has the normalized and resolved page title.
Just use it!

Change-Id: I2ec12f26c61899bf9b7106053964d7cc911b78da
---
M lib/config/MWParserEnvironment.js
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/56/327856/1

diff --git a/lib/config/MWParserEnvironment.js 
b/lib/config/MWParserEnvironment.js
index 2c75a53..b0885e1 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -552,7 +552,7 @@
 };
 
 MWParserEnvironment.prototype.normalizeAndResolvePageTitle = function() {
-       return this.resolveTitle(this.normalizedTitleKey(this.page.name));
+       return this.titleToString(this.page.title);
 };
 
 /* urlDecodedText will be in url-decoded form */
@@ -583,12 +583,16 @@
        return this._makeTitle(str, defaultNS, noExceptions);
 };
 
-MWParserEnvironment.prototype.makeLink = function(title) {
+MWParserEnvironment.prototype.titleToString = function(title) {
        var fragment = title.getFragment() || '';
        if (fragment) {
                fragment = '#' + fragment;
        }
-       return Util.sanitizeTitleURI(this.page.relativeLinkPrefix + 
title.getPrefixedDBKey() + fragment);
+       return title.getPrefixedDBKey() + fragment;
+};
+
+MWParserEnvironment.prototype.makeLink = function(title) {
+       return Util.sanitizeTitleURI(this.page.relativeLinkPrefix + 
this.titleToString(title));
 };
 
 MWParserEnvironment.prototype.isValidLinkTarget = function(href) {

-- 
To view, visit https://gerrit.wikimedia.org/r/327856
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ec12f26c61899bf9b7106053964d7cc911b78da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to