Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/294466
Change subject: Support ISBN link adaptation ...................................................................... Support ISBN link adaptation The href value of links adapted made relative URL so that parsoid will identify it as ISBN magic link. In addition to this, the href value of all adapted links made relative URL Testplan: Translate en:Eleanor Dark to es. Translate the section 'References' using MT or source. Inspect the href value of ISBN link after and before this patch. After this patch it should be just Special:BookSources/0732909031 without any domain prefix. Try publising the translation. The generated wikitext should not have ISBN as link but should be just "ISBN 0-7329-0903-1" and there should not be any surrounding <nowiki> tags. Bug: T110826 Change-Id: I5d66b931426ee83b026e8e0b7a5732a450825309 --- M modules/tools/ext.cx.tools.link.js 1 file changed, 16 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/66/294466/1 diff --git a/modules/tools/ext.cx.tools.link.js b/modules/tools/ext.cx.tools.link.js index d9dee6f..022381f 100644 --- a/modules/tools/ext.cx.tools.link.js +++ b/modules/tools/ext.cx.tools.link.js @@ -696,9 +696,24 @@ * Assmes cache.linkPairs are already populated. */ CXTargetLink.prototype.adapt = function () { - var title = this.getTitle(); + var targetHref, + title = this.getTitle(); + + // The href value of the links should be relative URLs. + // We had made the URLs absolute in source link to support opening in new tabs. + // If the href URL is absolute, magic links like ISBN won't work. + targetHref = this.$link.attr( 'href' ) + .replace( this.siteMapper.getPageUrl( mw.cx.sourceLanguage, '' ), '' ); + this.$link.prop( 'href', targetHref ); + // This is a minimal support for Magic links + // https://www.mediawiki.org/wiki/Specs/HTML/1.2.1#Magic_links + // XXX: Add an ISBN tool card + // XXX: Adapt the Special:BookSource prefix of href with target language + // namespace and alias. if ( !title ) { + // Links like ISBN(Magic links) usually does not have title and there + // is nothing left to adapt. return; } @@ -714,7 +729,6 @@ if ( cache.linkPairs[ title ] ) { this.title = cache.linkPairs[ title ]; this.$link.prop( { - href: this.title, title: this.title } ); this.adapted = true; -- To view, visit https://gerrit.wikimedia.org/r/294466 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d66b931426ee83b026e8e0b7a5732a450825309 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