This Forum has been archived

Visit the new Forums
Forums: Index Support Requests ParserFunctions support for ShowHide extension
FANDOM's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

50px-Replacement filing cabinet.svg

Note: This topic has been unedited for 1610 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

I currently have some problems with an support of parserfunctions inside an collapse class. Here an example:

  • The page it showed: {{Navbox troops}}
  • Navbox troops template: {{Navbox units}}{{Navbox neutral}}{{Navbox heroes}}
  • Navbox units:
{| class="navbox collapsible{{#switch:{{PAGENAME}}|Gremlin miner|Skully|Dead Knight|Zombie|Wolf|Imp|Gargoyle|Spidey|Medusa|Troll|Dragon|Vamp|Necromancer|Reap|Skully Archer|Lich|Little spidey|Mummy|Necromancer zombie|Goblin|Ghost|Nether Ghost|Cerberus=|#default= collapsed}}" style="width:100%; margin-top:1em; border:1px solid #999; font-size:90%; text-align:center;"
! style="background-color:#FF0000; color:#000000; padding:0.2em 0.5em;" nowrap="nowrap"|<div style="text-indent: 10%;">Units</div>
| style="padding:0.2em 0.5em;"| '''[[:Category:Passive units|Passive]]''': Gremlin miner<br />'''[[:Category:Melee units|Melee]]''': Skully · Dead Knight · Zombie · Wolf · Imp · Gargoyle · Spidey · Medusa · Troll · [[Dragon]]<br />'''[[:Category:Mid range units|Mid range]]''': Vamp · Necromancer · Reap<br />'''[[:Category:Long range units|Long range]]''': Skully Archer · Lich<br />'''[[:Category:Summoned units|Summoned]]''': Little spidey · Mummy · Necromancer zombie · Goblin · Ghost · (Nether Ghost)<br /><br />'''Unknown''': (Cerberus)

The other 2 are similar. Now is the question why it doesn't work. I currently removed the full common.js and testing on the userstyle. My user style:

And here's the css:

And here is the wikia.css:

Other notes are the the toggler extension also is installed like you can see with the user style js here is the code:

And last not least the showhide code. I only replace all names to + and - and removed the []

Finaly the old commons you can find here and here. If you known an fix please tell me.--Jens Ingels (talk) 13:11, July 27, 2012 (UTC)

I'm a little confused. What exactly isn't working? -- RandomTime 13:21, July 27, 2012 (UTC)
Wel I don't really understand myself what happend. But if I use an #switch code like in the example the collapse function will not work anymore. So there is something wrong the the ParserFuction. The code doesn't understand what to do if there is an #switch inside the class: class="navbox collapsible{{#switch:{{PAGENAME}}|Gremlin miner|Skully|Dead Knight|Zombie|Wolf|Imp|Gargoyle|Spidey|Medusa|Troll|Dragon|Vamp|Necromancer|Reap|Skully Archer|Lich|Little spidey|Mummy|Necromancer zombie|Goblin|Ghost|Nether Ghost|Cerberus=|#default= collapsed}}"--Jens Ingels (talk) 14:36, July 27, 2012 (UTC)

Put a space before the #switch. You are colliding the two classes together.

{| class="navbox collapsible<PUT A SPACE HERE>{{#switch:{{PAGENAME}}|Gremlin miner|Skully|Dead Knight|Zombie|Wolf|Imp|Gargoyle|Spidey|Medusa|Troll|Dragon|Vamp|Necromancer|Reap|Skully Archer|Lich|Little spidey|Mummy|Necromancer zombie|Goblin|Ghost|Nether Ghost|Cerberus=|#default= collapsed}}

The problem is that if your switch doesn't match anything then the #default will be used resulting in: class="navbox collapsiblecollapsed" (Notice how collapsible and collapsed are slammed together). The important thing to remember is that leading and trailing white-space is ignored by MediaWiki. The following 2 statements are identical:

{{     SomeTemplate    |    Param1
     | someparameter = Param  2     }}
{{SomeTemplate|Param1|someparameter=Param  2}}

Only whitespace after the first non-white-space character is included in the result. Trailing white-space (after the last non-white-space character) is also thrown away. This feature is actually very useful since it lets you break your template and parser functions across multiple lines so you don't have to cram everything on one really really long line. This is very important for readability when you start doing complicated things like putting an #if inside a parameter to a template inside a #switch inside another #switch.

BTW, you can see the problem using Web Inspector in either Firefox or Chrome (or Developer Tools in Internet Explorer, maybe). If you inspect the table generated by your navbox template, you can see the contents of the class attribute on the table tag which helps make these sorts of problems reasonably obvious. Lunarity 16:04, July 27, 2012 (UTC)

This will not fix the problem sorry. The code has worked with the old navframe extension. So I think the problem is in the js or will require an css code to let it work. --Jens Ingels (talk) 18:27, July 27, 2012 (UTC)

If you say so, but did you try it? Your code:

My code:

Lunarity 04:53, July 28, 2012 (UTC)

BTW, you said you removed the ShowHide code from the site's Common.js? I notice that you don't have an importScriptPage('MediaWiki:ShowHide.js'); in your user js. If the code isn't included then it won't run and it won't work. Lunarity 12:56, July 28, 2012 (UTC)

Found the problem. It seems the DynamicFunction extension crash when the toggler extension is installed. The problem is not the showhide but the ParserFunctions (build-in wiki) that crash or give an error with tables, not sure. So what I think for now the problem is the dynamicfunction. I currently removed it from the wiki. --Jens Ingels (talk) 00:20, July 29, 2012 (UTC)

Community content is available under CC-BY-SA unless otherwise noted.