Help talk:Magic words/Archive 001

Invoking tag without anonymous parameter
Hi, It look that invoking an XML-like extention with the #tag syntax but wihtout anonymous parameter is wrong. I made a test on the OpenStreetMap wiki (see ) with the folowing code and I got errors. But the following code (with an empty anonymous parameter) seems good (see ).

If the bug is from mediawiki, maybe it should be interresting to warn the users. FrViPofm 17:13, 31 August 2009 (UTC)


 * Why do you consider it a bug?


 * produces

< tagname parameter =" value "> content 
 * In your first example, you were sticking lat=47.2553 in as the content. Maybe it should be interesting to use it properly ^_^. Splarka 07:39, 1 September 2009 (UTC)
 * Because the syntax  is widely used for passing named parameters, it is strange to find it as anonymous parameter, and IMHO it is not consistent with the use of templates where we can find  FrViPofm 08:38, 1 September 2009 (UTC)
 * Well, it isn't "anonymous", it is just that the first parameter after the name is aways the content for #tag. Your use case happens to require it to be blank. That isn't buggy. Splarka 07:04, 2 September 2009 (UTC)

If I am not mistaken, this tag is no longer Expensive because of the schema changes made in 1.14 or 1.15. (Rob Church?)

If someone who knows better than I do agrees with my analysis, can you please remove that tag from the entry on this page?

Cheers!

--204.138.115.3 20:52, 3 September 2009 (UTC)

Request regarding urlencode
The old version on urlencode replaced spaces with underscores, however, a relatively recent change means that it now replaces spaces with plus signs. There is at least one (and I assume several) applications in which it is still necessary to have the underscore: when converting a string for use at http://stats.grok.se, underscores are required instead of spaces.

Therefore, is it possible for someone to create a new magic word called urlencode2 (or something similar)? This could process the subject string through urlencode, then change any instances of "+" to "_". If this is not the right place to request something like this, please direct me elsewhere. Thanks! --Zach425 19:11, 9 September 2009 (UTC)


 * Old version? relatively recent change? It looks like urlencode was introduced in 14273, only moved from Parser.php to CoreParserFunctions.php in 15276 where it has remained unchanged to this day. Where did you observe this change, Wikia perhaps? Splarka 07:10, 10 September 2009 (UTC)
 * Followup: here is the Help page on meta just a few weeks after it was introduced: . It shows  producing +x+y+%25%40. Splarka 07:23, 10 September 2009 (UTC)
 * You're absolutely correct - it seems I was MUCH mistaken regarding the "recent change". I'm sure I read that urlencode previously used an underscore instead of a plus sign (and its usage on Wikipedia suggests that this was indeed the case), but now I can't seem to find the site where I read that.
 * Urlencode aside, would it be possible to add rawurlencode as a magic word? I've found some documentation on it that indicates it would work for the problem stated above, as stats.grok.se accepts either _ or %20 in place of a space. Unfortunately, my very limited knowledge about PHP, Java, & MediaWiki doesn't allow me to act on what I've seen. Thanks again.  --Zach425 08:43, 10 September 2009 (UTC)
 * You can use the "escaped" version of the name-based magic words. For example: produces "", in a URL you can utilize it thusly: http://google.com/search?q= Splarka 13:26, 10 September 2009 (UTC)
 * THANK YOU, Splarka! This is just what I needed, but I unfortunately didn't understand FULLPAGENAMEE well enough to realize it! --Zach425 04:35, 11 September 2009 (UTC)

Using in a nested parser function
Sorry if this is a known workaround. I was unable to find it easily if it does exist out there somewhere.

I was running into a bit of a snag using the following parser function to evaluate whether a category should show a category tree or not (strictly a stopgap measure) at the top of the page.:

It seems that if there are more than 1000 pages in the category, fails because a comma is inserted into the number and the expression cannot parse it as a numerical value. The workaround here is to use the function:

RCWizard 23:12, 15 September 2009 (UTC)
 * You can just use NaN . That will also work on wikis set to a content language that delimits with periods, for example. Splarka 07:04, 16 September 2009 (UTC)