Forum:ParserFunctions support for ShowHide extension


 * NOTE: ALL PROBLEMS ARE FIXED

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

 {| class="navbox collapsible" 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"| Units Melee: Skully · Dead Knight · Zombie · Wolf · Imp · Gargoyle · Spidey · Medusa · Troll · Dragon Mid range: Vamp · Necromancer · Reap Long range: Skully Archer · Lich Summoned: Little spidey · Mummy · Necromancer zombie · Goblin · Ghost · (Nether Ghost)
 * The page it showed:
 * Navbox troops template:
 * Navbox units:
 * style="padding:0.2em 0.5em;"| Passive: Gremlin miner
 * style="padding:0.2em 0.5em;"| Passive: Gremlin miner

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? --  Random Time  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: --Jens Ingels (talk) 14:36, July 27, 2012 (UTC)

Put a space before the. You are colliding the two classes together. {| class="navbox collapsible&lt;PUT A SPACE HERE&gt; The problem is that if your switch doesn't match anything then the  will be used resulting in:   (Notice how   and   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: 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   inside a parameter to a template inside a   inside another.

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  attribute on the   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  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)