User:Crabbe/Sandbox
Notes about this wiki
No syntax highlighting. No LaTeX.
Template:Clanbox
Documentation follows below. Also some files:
- User:Crabbe/Sandbox/01 - Comparison of four versions of the Clanbox template.
- User:Crabbe/Sandbox/02 - Currently my version of a Clanbox template.
User:Crabbe/Sandbox/01, investigating the broken clanbox template 13:27, 15 May 2010 (UTC)
Template copied to User:Crabbe/Sandbox/02 13:37, 15 May 2010 (UTC)
Pages:
- Template:clanbox
- Template:clanbox_test
- Clan pages:
- Clan Eyecons - breaks under old template - copied to /01.
Adding a carriage return before each of the first two
{{#ifeq:
constructs fixes the problems with Eyecons at least. WTF.
Update 19:59, 15 May 2010 (UTC)
Okay more investigation today. I also found Skull Face's version and some discussion:
- Template:Clanbox_fix - Skull Face on September 5, 2008.
- Template:Clanbox_test - Alien pirate demon on September 5, 2008.
- User_talk:Skull_Face#Clanbox_Template
- Template_talk:Clanbox#Help_Me
After experimentation, reading about templates, reading about parser functions and reading about tables (tables at MetaWiki), I have come to the conclusion that the problem is because of formatting, specifically lack of line feeds in certain places. This is very hard to troubleshoot since in the default wiki editor it is impossible to tell the difference between a linefeed and word wrap. Further sometimes merely editing can cause line feeds to disappear see MetaWiki.
Using the subst:
construct it appears that in the original template we were getting lines like
"Eyecons"{{#ifeq:[[Image:PSLogo.gif]]||| {{!}}-style="background-color: #ffffff; text-align: center;" ...
another expansion would give
"Eyecons"{{!}}-style="background-color: #ffffff; text-align: center;" ...
with a LF being goobled up. One more expansion gives
"Eyecons"|-style="background-color: #ffffff; text-align: center;"
When MediaWiki tries to interpret this it gives an error. It expects the table row indicator, |-
to begin a line. No new row character then the following style
is misplaced etc.
The simple fix is to put in some LFs: The relevant section from the original template:
{| cellpadding="4" cellspacing="0" style="border: solid 1px #ccc; background-color: #f9f9f9; border-collapse: collapse; float: right; font-size: 95%; margin: 0 0 .5em .5em; width: 300px"¶ |colspan="2" style="background-color: #8b8; font-size: large; padding: 5px; text-align: center"| '''{{{clan_name| }}}'''{{#ifeq:{{{clan_image|}}}|||¶ {{!}}-style="background-color: #ffffff; text-align: center;"¶ {{!}}colspan="2"{{!}}{{{clan_image}}}}}{{#ifeq:{{{official_id|}}}|||¶ {{!}}-style="background-color: #c3ddc3; text-align: center;"¶ {{!}}colspan="2"{{!}}[http://www.shartak.com/clanview.cgi?id={{{official_id}}} In-game page]}}¶
Here ¶ indicates a coded line feed, lines with no ¶ at the end have no LF. To fix the template change it to:
{| cellpadding="4" cellspacing="0" style="border: solid 1px #ccc; background-color: #f9f9f9; border-collapse: collapse; float: right; font-size: 95%; margin: 0 0 .5em .5em; width: 300px"¶ |colspan="2" style="background-color: #8b8; font-size: large; padding: 5px; text-align: center"| '''{{{clan_name| }}}'''¶ {{#ifeq:{{{clan_image|}}}|||¶ {{!}}-style="background-color: #ffffff; text-align: center;"¶ {{!}}colspan="2"{{!}}{{{clan_image}}}}}¶ {{#ifeq:{{{official_id|}}}|||¶ {{!}}-style="background-color: #c3ddc3; text-align: center;"¶ {{!}}colspan="2"{{!}}[http://www.shartak.com/clanview.cgi?id={{{official_id}}} In-game page]}}¶
This works for the most part. See User:Crabbe/Sandbox/01
There is at least one small problem:
If there is no official_id
and no clan_image
files specified then both of the
{{#ifeq: ... }}
sections evaluate to a LF which puts two extra lines in the first row of the table. The solution was found in the MetaWiki help files. Adding
<nowiki />
tags prevents a LF from being goobled up in a parser function so things work as they should. LFs when they're needed, none when they aren't wanted.
{| cellpadding="4" cellspacing="0" style="border: solid 1px #ccc; background-color: #f9f9f9; border-collapse: collapse; float: right; font-size: 95%; margin: 0 0 .5em .5em; width: 300px"¶ |colspan="2" style="background-color: #8b8; font-size: large; padding: 5px; text-align: center"| '''{{{clan_name| }}}'''{{#ifeq:{{{clan_image|}}}|||<nowiki />¶ {{!}}-style="background-color: #ffffff; text-align: center;"¶ {{!}}colspan="2"{{!}}{{{clan_image}}}}}{{#ifeq:{{{official_id|}}}|||<nowiki />¶ {{!}}-style="background-color: #c3ddc3; text-align: center;"¶ {{!}}colspan="2"{{!}}[http://www.shartak.com/clanview.cgi?id={{{official_id}}} In-game page]}}¶
My version of the template is at User:Crabbe/Sandbox/02. Some samples are at User:Crabbe/Sandbox/01. Please put any comments on my [talk page].