jenkins-bot has submitted this change and it was merged.

Change subject: TemplateHandler: Detect simple URL template params and process 
them directly into HTML
......................................................................


TemplateHandler: Detect simple URL template params and process
them directly into HTML

Change-Id: I2c96cb0f78ecb40d013705d904b03ceec30e484d
---
M lib/ext.core.TemplateHandler.js
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/ext.core.TemplateHandler.js b/lib/ext.core.TemplateHandler.js
index a685d4a..dd313b0 100644
--- a/lib/ext.core.TemplateHandler.js
+++ b/lib/ext.core.TemplateHandler.js
@@ -20,6 +20,7 @@
        PreprocessorRequest = api.PreprocessorRequest,
        Util = require('./mediawiki.Util.js').Util,
        DU = require('./mediawiki.DOMUtils.js').DOMUtils,
+       entities = require('entities'),
        async = require('async'),
        // define some constructor shortcuts
        KV = defines.KV,
@@ -797,6 +798,11 @@
                                    (paramTokens.constructor === String ||
                                     isSimpleParam(paramTokens))) {
                                        param.html = param.wt;
+                               } else if 
(param.wt.match(/^https?:\/\/[^[\]{}\s]*$/)) {
+                                       // If the param is just a simple URL, 
we can process it to
+                                       // HTML directly without going through 
a sub-pipeline.
+                                       param.html = "<a rel='mw:ExtLink' 
href='" + param.wt.replace(/'/g, '&#39;') +
+                                               "'>" + param.wt + "</a>";
                                } else {
                                        // Prepare the data needed to parse to 
HTML
                                        params.push({

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2c96cb0f78ecb40d013705d904b03ceec30e484d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Marcoil <marc...@wikimedia.org>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to