In previous versions of MediaWiki, relative inclusions ({{../name}})
were not handled properly in the Main namespace - it tried to include
Template:Parent/name instead of just Parent/name article. In other
namespaces they worked, though (all in case of enabled subpages). The
patch fixes this inconsistence and allows to use relative inclusions
in Main.
Change-Id: Ie04f23c180e501631c629a39b997796a1725fb67
$ns = NS_TEMPLATE;
# Split the title into page and subpage
$subpage = '';
- $part1 = $this->maybeDoSubpageLink( $part1, $subpage );
- if ( $subpage !== '' ) {
+ $relative = $this->maybeDoSubpageLink( $part1, $subpage );
+ if ( $part1 !== $relative ) {
+ $part1 = $relative;
$ns = $this->mTitle->getNamespace();
}
$title = Title::newFromText( $part1, $ns );
</p>
!! end
+!! article
+Subpage test/L1/L2/L3Sibling
+!! text
+Sibling article
+!! endarticle
+
+!! test
+Transclusion of a sibling page (one level up)
+!! options
+subpage title=[[Subpage test/L1/L2/L3]]
+!! input
+{{../L3Sibling}}
+!! result
+<p>Sibling article
+</p>
+!! end
+
+!! test
+Transclusion of a child page
+!! options
+subpage title=[[Subpage test/L1/L2]]
+!! input
+{{/L3Sibling}}
+!! result
+<p>Sibling article
+</p>
+!! end
+
+!! test
+Non-transclusion because of too many up levels
+!! options
+subpage title=[[Subpage test/L1/L2/L3]]
+!! input
+{{../../../../More than parent}}
+!! result
+<p>{{../../../../More than parent}}
+</p>
+!! end
+
!! test
Definition list code coverage
!! input