Skip to content
Permalink
Browse files

Bug 42527 - <noinclude> tags broken in LST

The page loading machinery now mirrors the behaviour of
http://en.wikisource.org/w/api.php?action=expandtemplates&text={{Page:Dictionary%20of%20National%20Biography%20volume%2023.djvu/109}}

i.e. instead of retrieving the page text, we ask the parser to
expand the text "{{:{{FULLPAGENAME}}}}".

Change-Id: I721e8120b233f921d44261e9eea536efbb2c2735
  • Loading branch information...
valhallasw committed Nov 29, 2012
1 parent bbbad4c commit 0c5487b9724dabdb7391f31fd8e447823fbe310a
Showing with 42 additions and 17 deletions.
  1. +1 −17 LabeledSectionTransclusion.class.php
  2. +41 −0 lstParserTests.txt
@@ -272,24 +272,8 @@ static function getWikiPageDom( $title, $parserconfig ) {
return array( false, $finalTitle );
}
if ( method_exists( $page, "getContent" ) ) {
$content = $page->getContent( Revision::FOR_THIS_USER );
if ( !is_null( $content ) ) {
$text = $content->getWikitextForTransclusion();
} else {
$text = null;
}
} else {
$text = $page->getText( Revision::FOR_THIS_USER );
}
if ( is_null( $text ) ) {
wfProfileOut( __METHOD__ );
return array( false, $finalTitle );
}
$parser = new Parser( $parserconfig );
$finalText = $parser->preprocess( $text, $finalTitle, new ParserOptions() );
$finalText = $parser->preprocess( "{{:" . $finalTitle->getPrefixedText() . "}}", $finalTitle, new ParserOptions() );
$root = $parser->preprocessToDom( $finalText );
wfProfileOut( __METHOD__ );
@@ -561,3 +561,44 @@ Section B end
</p><p>Section A end
</p>
!!end

!!article
noinclude
!!text
<noinclude>before</noinclude>
<section begin="a" />sec a<section end="a" />
<noinclude>after</noinclude>
!!endarticle

!!test
LST: Noinclude tags should not be included - start at section
!!input
{{#lst:noinclude|a|}}
!!result
<p>sec a
</p>
!!end

!!test
LST: Noinclude tags should not be included - end at section
!!input
{{#lst:noinclude||a}}
!!result
<p>sec a
</p>
!!end

!!article
User:DifferentNamespace/subpage
!!text
<section begin="a" />sec a<section end="a" />
!!endarticle

!!test
LST: Transclusion from subpage in a non-standard namespace
!!input
{{#lst:User:DifferentNamespace/subpage|a}}
!!result
<p>sec a
</p>
!!end

0 comments on commit 0c5487b

Please sign in to comment.
You can’t perform that action at this time.