Topic on Extension talk:SubPageList

template parameter not evaluated when output

3
Chiefgeek157 (talkcontribs)

Using MW 1.25.1, I cannot seem to get the template parameter to work. Here are some examples using "Test Page", "Test Page/Subpage {1|2|3}", and "Template:Subpage list template" with the definition: "There is a subpage named {{{1}}}".

Works

{{#subpages:}}

  • Subpage 1
  • Subpage 2
  • Subpage 3

{{#subpages:pathstyle=full}}

  • Test Page/Subpage 1
  • Test Page/Subpage 2
  • Test Page/Subpage 3

* {{Subpage list template|Test Page/Subpage 1}}
* {{Subpage list template|Test Page/Subpage 2}}
* {{Subpage list template|Test Page/Subpage 3}}

  • There is a subpage named Test Page/Subpage 1
  • There is a subpage named Test Page/Subpage 2
  • There is a subpage named Test Page/Subpage 3

Fails

{{#subpages:template=Subpage list template}}

  • {{Subpage list template|Test Page/Subpage 1}}
  • {{Subpage list template|Test Page/Subpage 2}}
  • {{Subpage list template|Test Page/Subpage 3}}

So it appears that the list is generated correctly, but the resulting output is not passed through the template renderer.

Any clues about what could be preventing the output from being rendered as part of the extension when it renders as part of the page correctly?

Chiefgeek157 (talkcontribs)

If I am not mistaken, I would assume that HookRunner.php line 96 is the one that is supposed to render the template rather than return the wikitext containing the generated template text.

94 protected function getProcessedResultText( $resultText ) {
95    if ( $this->getOption( self::OPT_DO_PARSE ) ) {
96      return $this->parser->recursiveTagParse( $resultText, $this->frame );
97   }
98   return $resultText;
99 }

I am not skilled enough to debug this and confirm $resultText versus the output of $this->parser->recursiveTagParse($resultText). I tried commenting out the if statement to force the call to recursiveTagParse, but that did not change the result.

Chiefgeek157 (talkcontribs)

After more testing, I discovered that the "template" parameter doesn't appear to work.

In parser function mode as {{#subpages:|template=My template}}, the function Parser->recursiveTagParse() is never called because FunctionRunner is not passed the Parser instance.

In tag mode as <subpages template="My template"/> the HookRunner does call Parser->recursiveTagParse(), but the expansion is messed up. The content doesn't get put into the list item, but outside, and each item becomes a separate list.

<div class="subpagelist">
<ul><li> </li></ul>
<p>There is a subpage named Test Page/Subpage 1
</p>
<ul><li> </li></ul>
<p>There is a subpage named Test Page/Subpage 2
</p>
<ul><li> </li></ul>
<p>There is a subpage named Test Page/Subpage 3
</p>
</div>
Reply to "template parameter not evaluated when output"