Topic on Extension talk:Tabs

Issue: not loading the values for template parameters

8
DWizzy (talkcontribs)

When I create a template with parameters shown in tabs

<tabs><tab>{{{1}}} {{{foo}}} {{{bar|}}</tab></tabs>{{{1}}}{{{bar}}}

the parameters are not loaded when I include the template (eg {{{tabs|one|foo|bar}}}) The parameters outside the <tabs> tag are loaded properly.

Has anyone else experienced this? The (read-restricted) wiki is running Tabs version 1.3.2 on MediaWiki 1.27.8.

Joeytje50 (talkcontribs)

Hi there, there is one problem with your line of code I noticed, namely that your {{{bar|}} is missing a closing bracket. Please first try changing that to see if that fixes it. Otherwise, could you try using the parser-function syntax for the tabs? So, for your line of code, that would be:

{{#tag:tabs|
  {{#tab:| {{{1}}} {{{foo}}} {{{bar|}}} }}
}} {{{1}}}{{{bar}}}

Due to differences in the parsing of different types of functions, some functionality that is supported in the parser-function syntax is not supported in the tag syntax.

Hopefully this helps you!

DWizzy (talkcontribs)

I somehow missed your reply, thank you! :) Silly of me to give an incorrect example. The extra closing bracket didn't resolve it, nor did using the parser-function.

In the end I resorted to using the Extension:Variables parser function {{#var:foo}} after defining mapping all the template parameters to variables.

SciWhiz12 (talkcontribs)

For anyone else experiencing this issue:

I have also encountered this issue recently, and found a solution for it through modifying the extension. Here's a link to the commit which shows the implemented fix: github.com/forgecommunitywiki/mediawiki-extensions-Tabs/commit/20440ea2b2a6a7af438059c57135c2194a166b6b (I seem to be barred from adding a real hyperlink by the abuse filter, oh well).

To summarize it and to preserve the fix in case the link becomes dead, you have to modify the extension's code (includes/Tabs.php) so that the tab extension functions (for both <tab> and <tabs>) take in the extra $frame parameter and pass it into $parser->recursiveTagParse. This gives the parser access to the frame object, which allows it to do variable/parameter substitution.

I might push this change to the upstream repo in the future, but do not plan to do so for now because of my lack of experience in contributing to Wikimedia repos and lack of time to try do so. If anyone wishes to make the change upstream themselves, please feel free to do so (though I'd like to be given a bit of credit if possible).

YOUR1 (talkcontribs)
Jdforrester (WMF) (talkcontribs)

I've landed @YOUR1's patch, which will automatically ship in the REL1_39 branch which will be cut next week.

It could be back-ported to other versions if @Joeytje50 as maintainer wants to, but I don't want to pre-judge.

YOUR1 (talkcontribs)

We do need it in the 1.35 LTS version.

YOUR1 (talkcontribs)

Never mind this message; I'll pin our codebase at 4b1529d

Reply to "Issue: not loading the values for template parameters"