jenkins-bot has submitted this change and it was merged. Change subject: Handle interaction between linktrail and template ......................................................................
Handle interaction between linktrail and template arwiki/%D9%86%D8%B4%D9%8A%D8%AF_%D8%A7%D9%84%D8%AA%D9%82%D8%AF%D9%8A%D8%B3 Bug: 60752 Change-Id: I8c70d6f680dcf9509f80619430d89ad97a785555 --- M lib/dom.t.handleLinkNeighbours.js M tests/parserTests.txt 2 files changed, 20 insertions(+), 1 deletion(-) Approvals: Subramanya Sastry: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/dom.t.handleLinkNeighbours.js b/lib/dom.t.handleLinkNeighbours.js index 6d858c0..8fea07a 100644 --- a/lib/dom.t.handleLinkNeighbours.js +++ b/lib/dom.t.handleLinkNeighbours.js @@ -121,7 +121,8 @@ var ix, prefix = getLinkPrefix( env, node ), trail = getLinkTrail( env, node ), - dp = DU.getDataParsoid( node ); + dp = DU.getDataParsoid( node ), + dataMW = DU.getJSONAttribute( node, 'data-mw' ); if ( prefix && prefix.content ) { for ( ix = 0; ix < prefix.content.length; ix++ ) { @@ -129,6 +130,10 @@ } if ( prefix.src.length > 0 ) { dp.prefix = prefix.src; + if ( DU.isTplElementNode( env, node ) ) { + dataMW.parts.unshift( prefix.src ); + DU.setJSONAttribute( node, 'data-mw', dataMW ); + } if ( dp.dsr ) { dp.dsr[0] -= prefix.src.length; dp.dsr[2] += prefix.src.length; @@ -142,6 +147,10 @@ } if ( trail.src.length > 0 ) { dp.tail = trail.src; + if ( DU.isTplElementNode( env, node ) ) { + dataMW.parts.push( trail.src ); + DU.setJSONAttribute( node, 'data-mw', dataMW ); + } if ( dp.dsr ) { dp.dsr[1] += trail.src.length; dp.dsr[3] += trail.src.length; diff --git a/tests/parserTests.txt b/tests/parserTests.txt index c9003db..fbb317b 100644 --- a/tests/parserTests.txt +++ b/tests/parserTests.txt @@ -5625,6 +5625,16 @@ </p> !! end +!! test +Interaction of linktrail and template encapsulation +!! options +parsoid +!! input +{{echo|[[Foo]]}}l +!! result +<p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p> +!! end + !! article Söfnuður !! text -- To view, visit https://gerrit.wikimedia.org/r/111966 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8c70d6f680dcf9509f80619430d89ad97a785555 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <abrea...@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