Santhosh has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/332380 )
Change subject: Fix 'Main Page' appearing while auto-adapting templates ...................................................................... Fix 'Main Page' appearing while auto-adapting templates "Main Page" is frequently shown when auto-adapting templates that use {{PAGENAME}}, instead of the actual page name. This is because the templates uses current page name, and that information is not supplied to parsoid while doing wikitext to HTML transformation from CX Template editor. Pass target title to parsoid to fix this. Testcase: Translate 'Kevin de León' from en to es. In Es, the infobox uses template 'Ficha de autoridad'. It is a wikidata based template and need page name information. Without this patch, you will see Main Page coming as adapted template. With this, the whole infobox should get rendered. Bug: T154297 Change-Id: I0f2b9b633c214aec7ee2d45e3c25e19cb7ccc527 --- M modules/tools/ext.cx.tools.template.js M modules/util/ext.cx.util.js 2 files changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/80/332380/1 diff --git a/modules/tools/ext.cx.tools.template.js b/modules/tools/ext.cx.tools.template.js index 6794e51..91e9688 100644 --- a/modules/tools/ext.cx.tools.template.js +++ b/modules/tools/ext.cx.tools.template.js @@ -672,7 +672,7 @@ wikitext = this.getWikitext(); mw.log( '[CX] Updated template: ' + wikitext ); - return mw.cx.wikitextToHTML( this.siteMapper, this.language, wikitext ) + return mw.cx.wikitextToHTML( this.siteMapper, this.language, wikitext, mw.cx.targetTitle ) .then( function ( response ) { // TODO: Refactor this to a new method. var $newTemplate, i, $new; diff --git a/modules/util/ext.cx.util.js b/modules/util/ext.cx.util.js index 4846cbe..c487a1f 100644 --- a/modules/util/ext.cx.util.js +++ b/modules/util/ext.cx.util.js @@ -113,9 +113,10 @@ * @param {mw.cx.SiteMapper} siteMapper * @param {string} language * @param {string} wikitext + * @param {string} [title] * @return {jQuery.Promise} */ - mw.cx.wikitextToHTML = function ( siteMapper, language, wikitext ) { + mw.cx.wikitextToHTML = function ( siteMapper, language, wikitext, title ) { var url, domain; if ( !wikitext || !wikitext.trim() || !/\{\{|[\[<>&'=#*]/.test( wikitext ) ) { @@ -126,6 +127,9 @@ domain = siteMapper.getWikiDomainCode( language ); url = siteMapper.config.restbase.replace( '$1', domain ); url += '/transform/wikitext/to/html'; + if ( title ) { + url += '/' + title; + } return $.post( url, { /* eslint camelcase:off */ body_only: true, -- To view, visit https://gerrit.wikimedia.org/r/332380 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f2b9b633c214aec7ee2d45e3c25e19cb7ccc527 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits