ProfessionalWiki / ProfessionalWiki/SubPageList

template parameter does not work correctly

Open
#19 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
24
Forks
13
PR merge metrics
No merged PRs in 30d

Description

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

Using parser function with defaults: {{#subpages:}}

  • Subpage 1
  • Subpage 2
  • Subpage 3

Using parser function with pathstyle=full: {{#subpages:pathstyle=full}}

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

Manually invoking template in a hand-built list:

* {{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

Using parser function with the template parameter: {{#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}}

It appears that the list is generated correctly, but the resulting output is not passed through the template renderer. This is apparently in part because FunctionRunner has no access to the Parser instance so cannot render the resulting text. Not sure.

Using tag mode with template parameter: <subpages template="My template"/>

<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>

HookRunner calls 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. It appears that each list item is resolved into complete HTML as a separate list rather than waiting until all the items are combined to render into a list.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the #subpages template-parameter path through FunctionRunner and the tag-mode path through HookRunner and Parser->recursiveTagParse. Reproduce both examples from the issue; done means template output is rendered correctly and tag mode preserves the generated items in one properly formed list.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.