Template talk:Exists
From Wikipedia, the free encyclopedia
Contents |
[edit] Fooled
The template can be fooled by a page with only a self link
{{exists|User:Sgeo/trick-exists}}
1
Contents of User:Sgeo/trick-exists:
[[User:Sgeo/trick-exists]]
SgeoTC 23:56, 15 April 2006 (UTC)
- With the latest change this happens also for Template:Exists/demo which links to Template:Exists/Demo. It is still a harmless bug compared with the bug fixed by the change.--Patrick 15:08, 11 May 2006 (UTC)
[edit] True
At the moment only this talk page uses this template, how about replacing false by 0 and true by 1 for usage with #ifexpr: boolean operations? And why on earth is this template "esoteric", relics of the WP:AUM + WP:HIDE wars? -- Omniplex 04:51, 8 May 2006 (UTC)
Okay, now it is the Meta version, but it still says "1" (was "true") for Template:blablabla. I'm too lazy to debug this. -- Omniplex 02:44, 11 May 2006 (UTC)
[edit] New syntax
I've changed the extended syntax to use named parameters. The old syntax, using a single unnamed parameter for the page name, should still work. The "meta-style" syntax, which used the first unnamed parameter for either the namespace or the full page name, was simply unmaintainable.
I think I've got the namespace and capitalization issues mostly sorted out in the process, except for a few seemingly intractable cases that are documented above. The fundamental problem with the capitalization is that transcluding {{wikipedia:nosuchprojectpage}} gives Wikipedia:Nosuchprojectpage, with both the W and the N capitalized, while linking to it gives the uncapitalized wikipedia:nosuchprojectpage. We can and do capitalize the W with {{ucfirst:}}, but MediaWiki does not currently provide sufficiently versatile string manipulation functions to let us fix the case mismatch for the N.
This template really needs to be replaced with a parser function. —Ilmari Karonen (talk) 12:07, 11 May 2006 (UTC)
- This has been fixed by CBDunkerson at the minor cost of falsely reporting non-existence in the unlikely case that the contents of a page corresponds in a case-insensitive comparison with a selflink.--Patrick 15:18, 11 May 2006 (UTC)
I've removed the "ns" parameter, since after CBDunkerson's fix it is no longer useful for anything. The "name" parameter is still useful for page names that might contain equals signs, and in any case fits well with the named "then" and "else" parameters. —Ilmari Karonen (talk) 19:02, 11 May 2006 (UTC)
- In theory you can bypass the = problem also with 1=page. Maybe we should use 2 for then and 3 for else to imitate the #if: / #ifeq: / #ifexpr: syntax more closely. Using e.g. 2=has=equalsign is a technique known from other templates with positional parameters. -- Omniplex 05:26, 12 May 2006 (UTC)
- I added '2' and '3', but left the then and else in place. So the template can now be used either with named parameters like 'qif' or numbered parameters like '#if:'. --CBDunkerson 11:30, 12 May 2006 (UTC)
- Nice. I still feel that "esoteric" is more insult than praise, but admittedly it's now too complex to be edited by newbees based solely on "be bold"... <eg> -- Omniplex 12:40, 12 May 2006 (UTC)
[edit] New ParserFunction
This template has been subsumed by the new ParserFunction {{#ifexist}}: see bugzilla:6078. HTH HAND —Phil | Talk 08:32, 25 May 2006 (UTC)
[edit] New implementation
Current version is still widely used but not working. I wrote a new implementation which is supposed to be compatible to the previous semantics. Unfortunately, Template:Exists is currently protected. Can some administrator edit it? --Ororon 16:43, 24 January 2007 (UTC)
- Done. I optimized your version a bit further by inlining the call to {{if interwiki link}}. —Ilmari Karonen (talk) 14:04, 25 January 2007 (UTC)
- Anyway, must of the uses of this template listed on Special:Whatlinkshere came from a single instance on the metatemplate {{Infobox Music genre}}. After removing it, there are no more uses of this template in the main namespace left. —Ilmari Karonen (talk) 14:09, 25 January 2007 (UTC)