Admin Forum:Weird effect with the if parser function

Rubicon Development Wiki, click here.

I've been working with parser functions for years now and I've never seen anything like this before. It's gotta be some kinda bug, but I wanted to run it past people smarter than me before I reported. I have a simple link template called tardis:template:Delgado. It's basic function is to link to a particular part of the article tardis:the Master having to do with the interpretation by an actor named tardis:Roger Delgado. So basically, you type Delgado and it creates a link displaying as "the Master" but pointing towards a particular section of an article. Fine. Straightforward enough.

But, I wanted to be able to account for the fact that sometimes you need to be able to create a link for The Master, so that you can start a sentence with a capital The.

So here's the simple #if of it all:

Seems like it'd work, right? And it does — for the first option. If you type, you get a proper section link. But if you just type you just get a link to the Master.

I couldn't understand it, so I dug deeper and then found that if there was no space in the second display statement, the link was fine. Which means that the following two things work:

So my question is why? Why is the space okay in the first condition, but not in the second? I've never seen an #if statement be so finicky with spaces like this. Is this a MW 1.19 bug? 23:01: Fri 16 Nov 2012


 * I can't reproduce this bug, tardis:User:Acer4666/sandbox, the links seem to point to the right section-- Category:Acer4666 00:07, November 17, 2012 (UTC)


 * I couldn't reproduce this bug on tardis either, but it looks like that's because CzechOut has already fixed the template (and forgot to mention that detail). I did try to recreate the bug on my test wiki at w:c:mathmagician:IfLinkTest, but I still can't see any problem.


 * On a related note, the following should also work for the template:

he Master
 * Yeah I knew it was fixed, I unfixed it in my sandbox page but it still works-- Category:Acer4666 00:20, November 17, 2012 (UTC)
 * I can see that it works on your page, Acer. Which is completely confusing to me. I've gone ahead and created the next in the series, and am still getting the error. Compare and contrast tardis:template:Delgado and tardis:template:Ainley please. (Again, we're focusing on why the lowercase t "the Master" link behaves differently at Delgado than it does at Ainley.) 00:45: Sat 17 Nov 2012
 * I can see that it works on your page, Acer. Which is completely confusing to me. I've gone ahead and created the next in the series, and am still getting the error. Compare and contrast tardis:template:Delgado and tardis:template:Ainley please. (Again, we're focusing on why the lowercase t "the Master" link behaves differently at Delgado than it does at Ainley.) 00:45: Sat 17 Nov 2012


 * I don't see the effect - but these templates are acting oddly when placed on the same page. It's like they're interfering with one another. On tardis:User:Acer4666/sandbox, notice how the second Delgado template is linking to the Ainley section. This may be the bug with section links described here-- Category:Acer4666 01:06, November 17, 2012 (UTC)


 * It's good that we've finally been able to reproduce that problem at least. -452 01:27, November 17, 2012 (UTC)


 * To show &amp;nbsp;, type &amp;amp;nbsp; (and thanks for the new example) -452 00:47, November 17, 2012 (UTC)


 * I may not be fully understanding the issue, but perhaps you've reproduced the section link bug mentioned here: User_blog:DaNASCAT/Technical_Update:_November_13,_2012 (Acer4666 beat me to it.)
 * I've created a test template here: Sandbox_452/1, in use here: Sandbox_452 (Feel free to experiment with those pages)
 * I'm getting section links for all cases, but in the last example, where I've used the parameter "blah", the last two links are the same, when they should be different, as the others are. -452 01:09, November 17, 2012 (UTC)


 * Well the 13 November bug linked above wasn't the problem I was describing, but it definitely makes the idea behind these templates unworkable. We've gotta be able to link to different sections of tardis:the Master to write many of our articles.


 * The thing I'm actually talking about is that the Delgado template —at least as it sits at tardis:template:Delgado links to a specific section, as shown in the first example under the "usage" section head. By contrast tardis:template:Ainley does not link to a specific section in that first, lowercase the example. The only difference between the two codes is that, at Delgado, I've essentially created one word by using a non-breaking space in the pipe switch: the&amp;nbsp;Master. At Ainley, I've just typed the Master. There's really no reason for this behaviour, as far as I can see. 01:17: Sat 17 Nov 2012


 * Thanks, I see what you mean about it not working in the usage section.
 * I've created tardis:user:452/sandbox9, tardis:user:452/sandbox8, tardis:user:452/sandbox7, tardis:user:452/sandbox6 - and I appear to be getting the expected results when calling the template only once on a page, I'll keep experimenting. -452 01:27, November 17, 2012 (UTC)
 * Specifically, tardis:user:452/sandbox6 is using, and getting the correct link. -452  01:32, November 17, 2012 (UTC)
 * What happens if you edit tardis:Template:Ainley/doc and change to  ? -452  01:32, November 17, 2012 (UTC)


 * It doesn't work at all. It renders literally — i.e. .  The spaces allow the software to see the middle bit as a template with the name PAGENAME.  01:35: Sat 17 Nov 2012
 * Now I'm even more confused than ever. I've just used 452's tardis sandbox to write a natural-ish short paragraph using these two templates in various situations, and they link correctly, every time. I don't get it — but I guess I should be glad that they work correctly on a page outside of the template namespace, and that they don't seem plagued at all by the 13 November bug.   01:43: Sat 17 Nov 2012