Locke Cole wrote:
William Allen Simpson wrote:
[{{fullurl:Special:Whatlinkshere/{{{1}}}{{{2}}}|limit=999}} links]
Always works.
Because it's part of the full URL generated (see below).
Look it is carefully. It uses a / to indicate the parameter, yet when you use the navigation bar, it generates: http://en.wikipedia.org/w/index.php?title= Special:Whatlinkshere&target=User%3AWilliam_Allen_Simpson
I just tried hand typing: http://en.wikipedia.org/w/index.php?title= Special:Whatlinkshere/User%3AWilliam_Allen_Simpson
So, both forms work, and I'm guessing that the slash form was created as a workaround for the parsing issue.
Is there some reason that fullurl stops encoding spaces to underscores when it runs into a pipe?
The pipe adds parameters, basically {{fullurl:...}} seems to take this:
{{fullurl:<page>|<param-1>|<param-2>|...|<param-n>}}
And convert it into:
<page: converted to full URL>?<param-1>&<param-2>&...&<param-n>
Yes, but it's parsing the parameters, yet failing to do the escaping on them. Seems like a *bug* to me. However, there might be a good reason, it's just not documented....
And speaking of syntax, why {{fullurl: instead of {{#fullurl: to match the latest parser syntax?
Probably because the latter would break existing pages relying upon {{fullurl: ...}}. Also, my understanding of {{# was that it was only used for parser extensions (not built-in magic words/functions).
The "{{#if:" started using the standard PHP "if", although it now is a variant more like CPP #ifdef.
I'm not clear on the difference between parser extensions and magic functions. But I've not really looked at the code yet....
Anyways, getting back to the problem of spaces in parameters, I don't think URL encoding parameters would work. A better solution (IMO) would be to add two new magic words:
{{urlencode:<string>}} {{urldecode:<string>}}
Which would allow us to encode/decode URL parameters as necessary. Now if a dev could be convinced this is wise, we'd be set. =)
But urlencode and urldecode (and rawurlencode and rawurldecode) are PHP functions. They don't work the way we'd like, they encode spaces as '+' "for historical reasons" (that is, M$ visual basic), while we need '_'.
Maybe something like that is needed, but I'd rather concentrate on fixing possible bugs in this function before going off and making yet another almost but not quite the same as a floor wax and a dessert topping. (Mixing Hitchhikers Guide with Firesign Theatre metaphors.)