Last modified: 2013-06-24 20:50:53 UTC
When transcluding a template containing an extension tag (<references/> for example), template encapsulation is lost. Similartly, when passing in an extension tag as a template parameter the template encapsulation is lost: echo '{{echo|<references/>}}' | node parse <body><ol about="#mwt2" class="references" data-mw='{"name":"references","body":{"extsrc":"{{echo|}}"},"attrs":{}}' typeof="mw:Extension/references" data-parsoid='{"tsr":[0,22],"src":"{{echo|<references/>}}","dsr":[0,22,null,null]}'></ol> </body> We probably need to be smarter in unpackDOMFragments when the wrapper tokens have already received encapsulation info through token-based template encapsulation.
References is actually a special case as it does not yet use the DOMFragment mechanism. The proper fix is probably to convert it to use DOMFragment encapsulation and generic unpacking. A generic extension tag like math in a template parameter on the other hand is handled okayish: echo '{{echo|<math>1+1</math>}}' | node parse --extensions math <body><p data-parsoid='{"dsr":[0,25,0,0]}'><img class="tex" alt="1+1" src="//upload.wikimedia.org/math/d/9/6/d96e018f51ea61e5ff2f9c349c5da67d.png" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<math>1+1</math>"}}}' typeof="mw:Transclusion" about="#mwt2" data-parsoid='{"tsr":[0,25],"src":"{{echo|<math>1+1</math>}}","dsr":[0,25,null,null]}'></p> </body>
Fixed in https://gerrit.wikimedia.org/r/#/c/69020/