Help talk:Magic words

&#123;&#123;REVISIONxxx:Foo&#125;&#125;
Is there any way to get revision information using the magic words for another page such as getting  or   from  ? This would be useful for keeping track of articles in a project for a list of pages. Technical 13 (talk) 15:44, 22 May 2013 (UTC)


 * No. This can be handled by a DynamicPageList extension, though. --Ciencia Al Poder (talk) 09:11, 23 May 2013 (UTC)


 * +1 for feature request -- sir KitKat 78.21.21.68 07:38, 15 October 2013 (UTC)
 * Yes, this has worked for some time now. Guess no-one has patrolled this page in a while...  Foo was lasted edited on   by  (User:). Technical 13 (talk) 19:53, 10 November 2014 (UTC)

_NOEDITSECTION_ on every page?
Hey there, I am using Mediawiki and I have problems with partly editing of pages, so I want to disable the "edit section" Button for the whole wiki. Is this possible?
 * If there was such a thing, I would think it would be listed on Manual:Configuration settings (alphabetical), which it is not. However, depending on which version of MediaWiki you are running you could just set the class (use to be   but was recently renamed   on some wikis like en.wikipedia) for to   in your MediaWiki:Common.css --  Technical 13 (talk) 12:48, 15 June 2013 (UTC)

I'd like to be able to do this too
I don't understand the answer saying that you set \
 * or possibly, depending on the version of MW you are running:


 * to your MediaWiki:Common.css. Technical 13 (talk) 19:46, 10 November 2014 (UTC)

__DISAMBIG__
Could someone please add the necessary documentation for __DISAMBIG__ (Extension:Disambiguator) here and, if you could be so kind, also at en:Wikipedia:Magic words? Thank you. -- Michael Bednarek (talk) 13:48, 11 July 2013 (UTC)
 * I was under the impression that this page was reserved for core (or at least ships with core extension) magic words and I don't remember seeing Extension:Disambiguator being in that package. Is this going to be a new inclusion in the default package? Technical 13 (talk) 10:26, 17 July 2013 (UTC)
 * When I look up magic words on the EN Wikipedia, I often end up looking at Help:Magic words here on MediaWiki, because that page is linked there, e.g. at en:Help:Magic words. My impression, which may well be wrong, is that MediaWiki documents the MediaWiki software. If that is not so, feel free to remove the entry about  again; in that case, I wonder whether it would be better to remove the mentioned link to MediaWiki at "en:Help:Magic words" as well. -- Michael Bednarek (talk) 12:21, 17 July 2013 (UTC)

Number of files in Articles
Hi, Is there any way to be able to count the number of files (In my case: Images) shown in article/category? In other words, I want to have the number of occurrence of any in given article.

TNX --82.80.126.166 13:01, 23 October 2013 (UTC)

Fullurle
The magic word  is not described in this page, and I honestly don't know the difference between that and. Cainamarques (talk) 21:32, 6 December 2013 (UTC)

Displaying the article's author on the page
Is there any magic word for that? For example displays the username/IP of the last user, who edited the article. How to display the username/IP of the user, who created the article?--185.31.48.30 09:45, 17 April 2014 (UTC)


 * No. That would be an expensive operation, as MediaWiki should find the first revision of the current page. --Ciencia Al Poder (talk) 16:53, 17 April 2014 (UTC)


 * Requested on bugzilla:18748 in May of 2009. Technical 13 (talk) 19:32, 10 November 2014 (UTC)

Adding translatable docu to such a page is horrifying
This diff together with translate tags etc. causes fatals, so I gave up. Sorry for this. The standard nonsense error message "Fatal exception of MediaWiki exception" or what this is called will probably not help digging into the issue. --&#91;&#91;kgh&#93;&#93; (talk) 22:32, 4 July 2014 (UTC)

anchorencode
Did somebody change anchorencode ?

It now seems to strip italic markup, rather than encode it:

->

It just means that on en-wp, we have to clean up a few hundred articles where en:template:SfnRef (which uses anchorencode to generate anchors in footnotes) has anchors that are generated from italicised words. --RexxS (talk) 16:30, 6 July 2014 (UTC)

Variables that affect behaviour
Why are  and   listed under Variables when they do not "return information about the current page, wiki, or date"? Surely, since they "control the layout or behavior of the page", they should be listed at Behavior switches. This has come up at w:en:Help talk:Magic words. --Redrose64 (talk; at English Wikipedia) 10:14, 17 July 2014 (UTC)


 * I surmise it's because "switches" have a special  that doesn't accommodate parameters, whereas DISPLAYTITLE: and DEFAULTSORT: require them. Of the "variables" listed on this Help page, those that take parameters use them only to specify the object about which the "variable" should return information. As DISPLAYTITLE: and DEFAULTSORT: use parameters to set environmental states rather than report them, they are certainly a special case. Maybe they (along with NOEXTERNALLANGLINKS:) should be described as "environment variables", "behavior variables", or "behavior functions", and be placed in their own section or subsection in the page.
 * &#8942;
 * My suggestion at this point would be to rename the current "Behavior switches" section to "Behavior settings", move the current content of that section into a subsection called "Behavior switches", and add a second subsection called "Behavior functions" where DISPLAYTITLE:, DEFAULTSORT:, and NOEXTERNALLANGLINKS: are explained. I would also suggest that the list of "general types of magic words" in the lede be rewritten accordingly, mentioning the differences in effect, as well as in format, of the various kinds of magic words.
 * &#8942;
 * As an aside, I note that the keywords called "variables" on this Help page would probably be more accurately described as "functions", as they are used to return values that report some aspect of the environment, rather than to store arbitrarily-assigned values. But I guess that's a whole 'nother ball o' wax. — Jaydiem (talk) 16:56, 17 July 2014 (UTC)

Pages in category + sub categories
Is there a deeper penetrating {{ Pagesincategory that will also count the pages in the subcategories? That would be wonderful. Kmath87 (talk) 22:02, 8 August 2014 (UTC)
 * Not built in to the parser, Kmath87, no. You will have to use a recursive template, some kind of E:Loops, Lua (scribunto if I spelled that right), or javascript via the api if you want to have a count of all pages in a category & subcats. Technical 13 (talk) 12:14, 9 September 2014 (UTC)

What is the opposite of ?
If I know the page ID number, how do I find the page?

I see that, if I have the page name, the will give me the number, I'd just like to do it the other way around.

197.155.4.118 09:08, 20 August 2014 (UTC)


 * The answer to your question is . Technical 13 (talk) 19:20, 10 November 2014 (UTC)

Missing magic words
It looks like the following magic isnt listed: gives gives gives gives gives gives gives Christian75 (talk) 07:30, 30 September 2014 (UTC)


 * Maybe because the first four are considered the same as


 * August gives August
 * August gives August


 * As of today, the last two have been included on the page. Bennylin (talk) 10:14, 10 December 2014 (UTC)

Magic Word ' | '
When I created the template for this magic word, I was having an issue using it with tables when I passed them in parameters for templates. I was using the syntax for specifying why I created the template. One thing to note is that the '|' character must come immediately after the closing tag. Otherwise, the white space messes up the parsing of the character when being used in tables; at least for what I was using it for. A newline simply doesn't cut it. --Erutan409 (talk) 14:48, 5 October 2014 (UTC)


 * I have the same issue, have you found the solution?... Crystian

Proposition of text changes and errors.
--Jmarchn (talk) 06:26, 10 October 2014 (UTC)
 * In page name is nor translatable.
 * Where says:
 * "exactly as formatnum formats them with the wiki's locale" must be "exactly as  formats them with the wiki's locale"
 * "are changed; formatnum will only transform" must be "are changed;  will only transform"

Magic word print username??
There is some word that prints the username of the user who is seeing some page where is that MAGICWORD?-- Crystian Marquez
 * Crystian Marquez, Did you find any solution? --Mavrikant (talk) 16:34, 22 February 2015 (UTC)

Creation date
How can i get the "creation date" of a page? ... There exist some MAGICWORD?... or there exist a parser for get the creation date of a page?
 * I don't think that's possible by current Magic words. Bennylin (talk) 10:01, 10 December 2014 (UTC)

How to create a filepath for a specific page in a PDF or DJVU? It only accept one parameter, thumb size, and right now it only works for the first page of the PDF. Thanks. Bennylin (talk) 08:54, 10 December 2014 (UTC)


 * My current workaround on includes\parser\CoreParserFunctions.php (MW 23.1) is by adding the third argument ($argC) and one line of code. So now I could call the thumbnail for page 2 of the PDF . I'm not sure this is the best solution though. Bennylin (talk) 09:58, 10 December 2014 (UTC)

$parsedWidthParam['page'] = $argC;

Magic Word for IP address lookup
Are there any magic words to look up someone's IP address? 47.20.96.42 19:53, 28 December 2014 (UTC)
 * There is a special user right to get this data at all (checkuser or oversight, I always forget what is what). IOW, no. –Be..anyone (talk) 11:47, 29 December 2014 (UTC)

language magic word
It would appear that  where   is an ISO 639-3, three letter language code, either doesn't work as it should or that the documentation, such as it is, that suggests that ISO 639-3 language codes should work, is incorrect:

As a check, switching to ISO 639-1 works:

So, the questions are:
 * 1) Should  return a language name for three character ISO 639-3 language codes?
 * 2) If no, shouldn't the documentation state that  only supports ISO 639-1?
 * 3) If yes, where is the error and how does it get fixed?

—Trappist the monk (talk) 19:09, 10 January 2015 (UTC)


 * 1.1 no: The docu shouldn't say only, e.g.,  gives  . Some ISO 639-3 three letter codes have older ISO 639-1 two letter codes. From the work on RFC 4646 (predecessor of RFC 5646) I recall that ar and zh were the worst cases. Check out section 2.2.2 in 5646 about "macrolanguage zh". Admittedly arb also doesn't work, maybe the logic is "support only the shortest code". –Be..anyone (talk) 07:28, 13 January 2015 (UTC)


 * I'm confused. We aren't talking about language sub-tags; the documentation for   makes no mention of sub-tags.  The documentation says that it "[returns the] full name of the language for the given language code"  where 'language code' is vaguely defined as ISO 639-3.  Because   is a legitimate ISO 639-3 code (see at registration authority: ara)   should return Arabic which the language name assigned by the registration authority, shouldn't it?


 * —Trappist the monk (talk) 14:01, 14 January 2015 (UTC)
 * ISO 639 macrolanguage != language, if there is a problem it would be arb, not ara. –Be..anyone (talk) 08:45, 15 January 2015 (UTC)

Missing magic word
I just figured out that  outputs the current month in a non-zero padded format (shown here: ). The only problem is I am unsure of how to add it to the table without breaking the  tags, as each one is numbered.

--KnightMiner (t/c) 03:33, 22 January 2015 (UTC)
 * I just added it without a number. Seems to render fine.  —   03:44, 22 January 2015 (UTC)

Failed to mark for translation
Failed to mark the page for translation: Function: MessageGroupStats::clearGroup Error: 1205 Lock wait timeout exceeded; try restarting transaction (10.64.16.27)

EXPENSIVE tag
What does it mean when a magic word is tagged as 'expensive' ([EXPENSIVE])? For example, the  magic word. In the description column, it says:
 * [Expensive] Number of pages (including subcategories and files) in the given category. (Category:Help used for demonstration)

I had one thought of what the term 'expensive' means, which was that it ate up a lot of server memory? Or just in general, related to servers? Also, what makes some magic words 'expensive' and others not? Codyn329 (talk) 00:37, 12 March 2015 (UTC)
 * Check out Special:TrackingCategories and Category:Pages with too many expensive parser function calls, it's a tilt - game over effect. Articles be Turing Machines. Admittedly implementing the Ackermann function with templates is fun. –Be..anyone (talk) 17:34, 13 March 2015 (UTC)

urlencode
Is it possible to use this, to construct a link to an external webpage? An example would be greatly appreciated. --&#91;&#91;User:Bmrberlin&#124; Bernd M.&#93;&#93; (talk) 11:26, 31 March 2015 (UTC)
 * There are three examples in the 2nd column of three, and there's a cheat sheet in the 3rd column: In essence urlencode always does the same thing, percent-encode Unicode, e.g., the input á u+00E1 is encoded as %C3%A1 for UTF-8 C3A1=C000+0300+0080+0021, with C=1100 for length two bytes, 3=0011 for some high bits, 8=10(00) for two bits indicating a tail byte, and 21=(00)10 0001 for six low bits. Putting hi+lo together that is (bits) 0011 10 0001 = (hex) E1 = u+00E1 as expected.
 * For the space character u+0020 you have to say what you want. Default or QUERY encodes spaces as + suited for, e.g., google queries. WIKI encodes spaces as _ as you would need it for a . And PATH percent-encodes spaces as %20, suited for everything else, also known as URL-encoding. –Be..anyone (talk) 22:27, 31 March 2015 (UTC)

doesn't work with hidden comments
I try to include the unexpanded wikitext of a page (this) into another page (this). I use, but I have a problem with hidden comments in the original page. Some are included, others aren't! Can you help me? Thanks in advance. --FRacco (talk) 11:14, 9 May 2015 (UTC)
 * The visible XML-comment is within a gallery. All other XML-comments never make it into msgnw. Something isn't as it should be, please report the bug. –Be..anyone (talk) 08:27, 9 July 2015 (UTC)

Help! I'm completely stumped!
Hi, I was wondering if anyone can help me out or at least point me in the right direction as to where I can solve this problem. I have imported some pages and templates into my wiki from Wikipedia but they are not displaying correctly. In all the inboxes I get a bunch of errors saying "mw:Help:Magic words#Other"

For the life of me, I can't figure out what the problem is.

Can anyone help me out please.

Thanks

Here's a link: http://games.appipedia.com/wiki/Dizzy_–_The_Ultimate_Cartoon_Adventure


 * The problem is one of the included templates of the page. See . --Ciencia Al Poder (talk) 09:31, 2 June 2015 (UTC)

Thanks for your help!

Help for translation
Hello, I recently made changes in this help page, but these changes are not transposed in the other languages. I guess this is related to the header saying "This page contains changes which are not marked for translation.", but I don't know how to mark my changes for translation. Anyone can tell me the way to do that? Best, Wikini (talk) 07:32, 5 June 2015 (UTC)
 * The message disappeared, I guess that someone made the changes needed. I again make changes in the English version and this message appears again. Best, Wikini (talk) 08:11, 9 June 2015 (UTC)

Behavior switch for auto-numbering section headings
I suggest to create a new  behavior switch to force auto-numbering the section headings. It would be useful in votes and polls, and in some structured pages. It should override individual user preferences in the page where it is included. Gustronico (talk) 02:19, 6 July 2015 (UTC)


 * Already filled on phabricator. --Ciencia Al Poder (talk) 19:05, 8 July 2015 (UTC)

PAGESINCATEGORY intersection
Is there anyway to do a PAGESINCATEGORY intersection with the current magicwords? E.g.,  in the enwp search bar shows the intersection between the two categories. I'd like to easily calculate the number of hits for that intersection. – czar   20:53, 3 August 2015 (UTC)

and don't work well together with apostrophe in filename
doesn't return a filepath, although filepath does with only the filename and does return the right filename.--AdSvS 07:29, 6 August 2015 (UTC)
 * seems to be saying that something should be returned but it returns blank:
 * The first problem is that File:Our country's report.pdf doesn't exist, and  always returns a null string for non-existent files. If we try the same thing using the name of a file that does exist, but contains no apostrophes, such as File:ChameleonSkin.png we get the expected result:
 * Trying a file which exists and also contains apostrophes, such as File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png, we get a null string:
 * If we test each part separately, we see
 * i.e. it is something to do with the combination of the two functions. I think the actual problem is that  encodes certain characters, i.e. the apostrophe becomes the numeric entity  . --Redrose64 (talk; at English Wikipedia) 14:37, 6 August 2015 (UTC)
 * Thanks for the elaboration. That was indeed what I wanted to say and the filename was only an example. But your way is much, much better and I'll think about it when I run into strange things again! --AdSvS 15:51, 6 August 2015 (UTC)
 * And there's a bug for that! . This happens with other magic words as well. --Ciencia Al Poder (talk) 19:00, 9 August 2015 (UTC)
 * Thanks, that explains it, Brion added a link to the closed T16779 eight years ago, and in T16779 Tim Starling wrote six years ago: I don't see the need to take MediaWiki apart and put it back together again when you could just fix your broken #ifexist calls. Therefore I guess this is working as designed, you are not supposed to use minimally (PAGENAME) or fully (PAGENAMEE) encoded strings with filepath:. Suggestion, would&hellip;
 * &hellip;work for you? The behaviour is documented for #titleparts and here as Warning . Be..anyone (talk) 20:40, 7 April 2016 (UTC)
 * i.e. it is something to do with the combination of the two functions. I think the actual problem is that  encodes certain characters, i.e. the apostrophe becomes the numeric entity  . --Redrose64 (talk; at English Wikipedia) 14:37, 6 August 2015 (UTC)
 * Thanks for the elaboration. That was indeed what I wanted to say and the filename was only an example. But your way is much, much better and I'll think about it when I run into strange things again! --AdSvS 15:51, 6 August 2015 (UTC)
 * And there's a bug for that! . This happens with other magic words as well. --Ciencia Al Poder (talk) 19:00, 9 August 2015 (UTC)
 * Thanks, that explains it, Brion added a link to the closed T16779 eight years ago, and in T16779 Tim Starling wrote six years ago: I don't see the need to take MediaWiki apart and put it back together again when you could just fix your broken #ifexist calls. Therefore I guess this is working as designed, you are not supposed to use minimally (PAGENAME) or fully (PAGENAMEE) encoded strings with filepath:. Suggestion, would&hellip;
 * &hellip;work for you? The behaviour is documented for #titleparts and here as Warning . Be..anyone (talk) 20:40, 7 April 2016 (UTC)
 * &hellip;work for you? The behaviour is documented for #titleparts and here as Warning . Be..anyone (talk) 20:40, 7 April 2016 (UTC)
 * &hellip;work for you? The behaviour is documented for #titleparts and here as Warning . Be..anyone (talk) 20:40, 7 April 2016 (UTC)

Substituting PAGEID
The page id can be substituted with when editing an existing page. Can it be substituted when creating a page? GeoffreyT2000 (talk) 00:09, 26 December 2015 (UTC)


 * No, content is parsed before the new page is created, so it doesn't have page id at this stage. That's similar with REVISION variables. --Ciencia Al Poder (talk) 10:56, 26 December 2015 (UTC)

fullurl now outputs protocol specifier?
is described as: A protocol-relative path to the title. This will also resolve interwiki prefixes. Note: Unbracketed (plain) protocol-relative links are not automagically linked.

But in my MW 1.26 the output is a complete URL including "https:" and is automatically turned into a link!

Is this a new behaviour, or is it specific to my configuration?

--Ahmad Gharbeia أحمد غربية (talk) 11:01, 6 April 2016 (UTC)


 * I guess you should also have a protocol-relative $wgServer for it to work as described. --Ciencia Al Poder (talk) 19:43, 6 April 2016 (UTC)

Gender magic word
In my opinion Gender magic word should work in Help namespace too. I created a task on Phabricator. --Dvorapa (talk) 15:34, 13 June 2016 (UTC)

__NOGALLERY__ question, feature request
This tag is used in wikipedia mainly to avoid copyright problems in image categories, but unfortunately it makes it difficult to check which images need improvement. My question: is there a way to override the __NOGALLERY__ tag without removing it? If not, would it be possible to add such a feature? (e.g.- append "ignoreNogallery" to the url, or something similar). Thank you --Benstown (talk) 04:27, 31 August 2016 (UTC)

DISPLAYTITLE Example
While not clear from the current Help page description, DISPLAYTITLE may be used to creatively format page titles with  tag style. One example of this is hiding the namespace and base page name for subpages. The following code displays subpage name only.

Dave Braunschweig (talk) 13:58, 15 September 2016 (UTC)

Add magic word like REVISIONDATE
Whilst creating a content page i am missing the possiblity to create a simple revision date. The method i am using now is as follows: It would be much easier to have something like  in stead


 * You have  which you can format with   --Ciencia Al Poder (talk) 10:22, 30 December 2016 (UTC)


 * Your solution wont work,it just shows the timestamp Type Faiverly 	Faiverly 		20161230151037 }}


 * It pretty much works: --Ciencia Al Poder (talk) 16:14, 30 December 2016 (UTC)

How to create dynamic dates (ie: 27 + 1 = Tomorrow's date)
Does anyone know of a way to do this?

MikeDarling (talk) 04:17, 24 February 2017 (UTC)


 * UPDATE: I found a solution on Wikipedia. //2024 produces: //2024 (which is tomorrow's date based on the server time).  There's more that can be done too.  See https://en.wikipedia.org/wiki/Wikipedia:Date_math for more info.
 * MikeDarling (talk) 04:42, 24 February 2017 (UTC)


 * Your solution has a flaw, because the last day of the month will give a non-existent date. You should get a date as a whole, add 1 day to it and get back the text representation of it. See Help:Extension:ParserFunctions:  gives   --Ciencia Al Poder (talk) 10:47, 24 February 2017 (UTC)


 * Thanks! I knew there had to be a better way. MikeDarling (talk) 22:09, 27 February 2017 (UTC)

Is the version 1.7 in the Namespaces section correct?





 * Name of the associated content namespace
 * Name of the associated talk namespace
 * Name of the associated talk namespace
 * Name of the associated talk namespace
 * Name of the associated talk namespace
 * Name of the associated talk namespace

Should the version really be 1.7 for these 2 items?


 * Why not? Here are the release notes for 1.7 that prove it. --Ciencia Al Poder (talk) 20:13, 30 March 2017 (UTC)

Fullurl:page name
Hello.

When I create a template with this magic word - fullurl, it return an error massage. It say there is a mistake in the title. What can be the prublem? Betmidrash (talk) 14:18, 4 May 2017 (UTC)
 * What is the title and what is your code? Matěj Suchánek (talk) 11:58, 5 May 2017 (UTC)
 * Hi. What do you mean? The problem is not on the sites of WikiMeda, it's happen in my private wiki. When I use the magic-word: FULLURL in some template, and try to enter the URL, it say that there is a mistake in the title...
 * Betmidrash (talk) 08:03, 14 May 2017 (UTC)

urlencode: ... < /syntaxhighlight>
Hello!

I'm trying to pass a code snippet to a template. The code snippet uses ... < /syntaxhighlight>. I would then link to urlencode that code snippet, but urlencode: ... < /syntaxhighlight> doesn't work - presumably because syntaxhighlight somehow pulls the text out of the processing flow? Any ideas how this could be achieved? I.e. something like:

Template:ShowCodeMakeUrl myserver?q= which is called as It works fine in terms of displaying the code, but urlencode doesn't handle the &lt;syntaxhighlight>... Thanks! Bjohas (talk) 13:56, 5 May 2017 (UTC) (Also see: https://www.mediawiki.org/wiki/Topic:Tpz21dqvqgkokhfl)


 * I did not fully understand your plan.
 * What is a “code snippet” and where is the problem?
 * Yes, your assumption is right: syntaxhighlight pulls the content out of the source text around.
 * The parser will put the stuff between  tags aside and transclude it later into the HTML document.
 * It is not possible to wrap something into  tags first and process the content later. The other way around works.
 * I fail to guess your expectation, is there a link supposed to be clickable, or shall the URL be displayed as code?
 * Note that for security reasons no external server must contribute code, but internal pages only and may be transcluded.
 * As far I read your intention try something like that:
 * Displaying generated URL, simply use, why coloured syntaxhighlight?




 * A clickable link with coloured syntaxhighlight as linktext, got passed a pipe-escaped code snippet, but no line breaks:
 * Template programming of ShowCodeMakeUrl:

 
 * Transcluded with:




 * Greetings --PerfektesChaos (talk) 03:46, 6 May 2017 (UTC)


 * I'll try to summarize all requirements we have:
 * - Source code (actually "Overpass QL" language) is passed to template as a parameter
 * - Source code is rendered with syntax highlighting, preserving any new line characters
 * - An additional icon with hyperlink is generated, hyperlink includes source code as URL parameter. All newline characters need to be preserved!
 * - If you click on the hyperlink, you'll see exactly the same source code as shown on the wiki page.
 * See this page with the template in action: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example
 * Bjohas wanted to find out some way to get rid of the sometimes insane escaping, like  instead of  . This would have the advantage, that a user can just copy & paste some source code as a template parameter and doesn't have to bother with escaping.
 * For even more details: see https://github.com/tyrasd/overpass-turbo/issues/288
 * Mmd-osm (talk) 06:51, 6 May 2017 (UTC)


 * Template:OverpassTurboExample is already using the means I suggested above.
 * Note:  is called   today.
 * Therefore,  is already present like I proposed   above.
 * Template programming functionality is as best as possible yet.
 * Your real problem is easy escaping of  since those curly brackets are colliding with Wiki syntax.
 * The solution is quite easy:


 * The enclosing nowiki-tags when providing the  parameter will be stripped off before their content is passed as   inside the programming.
 * However, they will prevent  getting evaluated too early. It is intended that this should happen in advance usually. When returning, their remainders won’t get expanded any longer.
 * Should work. Enjoy.
 * Entire code should be able to be wrapped this way without touching anything inside.
 * The basic idea when this thread has been opened was fine: enclosing the program code into something to prevent from evaluation.
 * However, syntaxhighlight is a very powerful thing that does a lot of analysis and produces sophisticated output with error messages and highlighting. That is parked outside the wikitext and merged later when the HTML document is composed.
 * 15 years old nowiki has the same disabling effect, but on low level, just hiding its content once from parsing, and bye.
 * Greetings --PerfektesChaos (talk) 17:01, 6 May 2017 (UTC)


 * Thanks a lot for the detailed feedback! We have tried the nowiki approach before. Unfortunately, it has one major shortcoming: the source code is no longer passed on to the URL parameter: https://wiki.openstreetmap.org/wiki/User:Mmd/TurboExample - so our initial requirement  If you click on the hyperlink, you'll see exactly the same source code as shown on the wiki page. is no longer fulfilled using this approach. Not sure if there's some way to get around this limitation? Mmd-osm (talk) 07:29, 7 May 2017 (UTC)


 * Sorry, my approach has the same pitfall like syntaxhighlight, since nowiki also gets some kind of escaping and is not available for a parser function. I never noticed that yet.
 * Then, the only way to relieve your burden a bit is as follows:
 * Create an auxilary template:bracketed (or any other name).
 * Implement that as follows:

Good luck --PerfektesChaos (talk) 15:02, 7 May 2017 (UTC)
 * Transclude
 * At least slightly more readable.
 * The last remainig syntax with no extra template would be:
 * Many thanks for the suggestions - that's helpful! The developer of https://github.com/tyrasd/overpass-turbo has included an 'escaping mechanism' that essentially does this https://github.com/bjohas/mediawikiencode. Many thanks. Bjohas (talk) 10:43, 8 May 2017 (UTC)

On the letter-case of Variables
Hi, I'm recently working on a parser on wikitext, and have read this page so that I can decide whether a "transclusion" is actually a variable or parser function.

Variables, per definition, are uppercase words surrounded by double braces, so  are variables. On the contrary, I believe, parser functions (esp. those starting with ) are case-insensitive.

However, some "variables" are suprisingly case-insensitive, for example,  will still be parsed to  ; while others, e.g.   are not (e.g.  ). Though I can hard-code a list for these built-in variable and parser function names, I just couldn't figure out why some "variable"s should be case-insensitive, as it's against the definition in Help:Magic words.

Another problem that confuses me: in Help:Magic words, it's said that behavior switches, variables, and parser functions are three kinds of magic words, but in Manual:Magic words, magic words are defined as "… a technique for mapping a variety of wiki text strings to a single ID that is associated with a function. Both variables and parser functions use this technique." I was thinking about a name to indicate either variables or parser functions, while to distinguish from behavior switches, because variables and parser functions share the similar traits (e.g. the first argument is started with colon, not pipe). Now I'm using something like "Magic Template" but not sure whether it's suitable. Any suggestions? Thank you!

--CXuesong (talk) 08:00, 12 May 2017 (UTC)

0 result doesn't include comma separator in mywiki
The result value of 123,456,789,000 in Burmese Wikipedia (mywiki) shows as "၁၂၃၄၅၆၇၈၉၀၀၀" without comma separator. To include group separator in mywiki, how should I do? Ninja ✮ Strikers «☎» 03:51, 6 July 2017 (UTC)


 * I've been digging in the code and I can't find why it's not formatting it correctly. looks correct. API request for easy testing. I suggest you to open a task for this --Ciencia Al Poder (talk) 09:49, 6 July 2017 (UTC)

Username
Is there anything that can detect a character's username? For example, if your name was UserGuy1, the code or something similar would become UserGuy1. Is there anything that can do this? 96.48.149.66 07:25, 29 July 2017 (UTC)


 * You may try Extension:GetUserName but I'm not sure if this extension will work in current versions of MediaWiki and it also breaks caching. --Ciencia Al Poder (talk) 15:34, 30 July 2017 (UTC)

: bug
On pl wiki and (probably) some others doesn't count new pages, but counts deleted pages. Sławek Borewicz (talk) 19:45, 20 February 2018 (UTC)
 * I can confirm half of what you are reporting. There's been a lot of [//pl.wikipedia.org/wiki/Specjalna:Ostatnie_zmiany?hidepageedits=1&hidecategorization=1&hideWikibase=1&limit=50&days=7&urlversion=2 page creation and deletion] lately on plwiki, so I was able to monitor the statistics (more or less) "live" as pages were created and deleted. What I saw is this:
 * the page count decreased when pages were deleted (and, as far as I could tell, it seemed to be decreasing by the correct amount each time),
 * the article count decreased only sometimes when pages were deleted (which would be expected if some deleted pages counted as articles and some didn't),
 * the article count increased but the page count did not change when an article (with links) was created, and
 * the page count did not increase when a new page was created outside of the main namespace.
 * The last two things do seem to be a bug and not just due to lag. I watched for more than 25 minutes and never saw the page count go up despite multiple page creations in that time. I guess this deserves a Phabricator task (i.e., bug report). - dcljr (talk) 21:17, 20 February 2018 (UTC)
 * Turns out, this was a known bug that has been fixed. Camping out at [//pl.wikipedia.org/wiki/Specjalna:Ostatnie_zmiany?hidepageedits=1&hidecategorization=1&hideWikibase=1&limit=50&days=7&urlversion=2 pl:Special:RecentChanges] and pl:Special:Statistics for a while, I was able to verify that page creation is now increasing the page count. - dcljr (talk) 01:07, 22 February 2018 (UTC)
 * Thx (for the info). Sławek Borewicz (talk) 16:55, 22 February 2018 (UTC)

You forgot equal
You forgot to document =. (seems to be a template currently, but should be a magic word)

Two hours and a headache. Alexis Jazz (talk) 10:21, 23 July 2018 (UTC)
 * No, it’s not forgotten. This page documents things that are magic words, not those that should be . = is not a magic word. You can propose it to became one on Phabricator, and, if implemented, it will be documented here. —Tacsipacsi (talk) 12:55, 23 July 2018 (UTC)

Templates, not magic words
Some variables listed, such as, are templates, and not magic words.TheConqueror4712 (talk) 00:55, 8 October 2018 (UTC)
 * I don’t think so. It’s used on this page, but Help:Magic words doesn’t appear on Special:WhatLinksHere/Template:ROOTPAGENAME. Looks like StructuredDiscussions thinks MediaWiki doesn’t support it, but it does. —Tacsipacsi (talk) 07:19, 8 October 2018 (UTC)

JS to make "wgRevisionId" a magic word
Hi,

I'm using Extension:Approved Revisions [1] and I have a need to be able to display the revision ID of the page revision currently being viewed. From the MW Manual page on Javascript [2] I see that the variable "wgRevisionId" contains this information and is exposed to mediawiki for use, but it is not clear to me how to do so. I would like to create a magic word [3] called  that outputs the revision ID of the revision being viewed such that it can be used in other parser logic

For example:

Can someone please help me identify the way to make a magic word that contains the value of "wgRevisionId"?

Thank you! -Rich User:revansx

[1] https://www.mediawiki.org/wiki/Extension:Approved_Revs

[2] https://www.mediawiki.org/wiki/Manual:Interface/JavaScript

[3] https://www.mediawiki.org/wiki/Help:Magic_words

Let's concentrate all discussions in one place: Extension talk:Approved Revs --Ciencia Al Poder (talk) 09:09, 25 October 2018 (UTC)

CURRENTWEEK/YEAR when 31 Dec is on a Monday
Hello from Monday, 31 Dec 2018, where CURRENTWEEK returns 1 and CURRENTYEAR returns 2018, resulting in nonsense when used together. I'm guessing that CURRENTWEEK is handled like ISO week dates but CURRENTYEAR is Gregorian, resulting in weird behavior on this edge case. -PFWOz (talk) 19:02, 31 December 2018 (UTC)


 * Dug through some 10-year-old bug tickets and the workaround is to use . T18838:


 *  Use combination instead of  or 2024/. 


 * This should be made much clearer in the documentation, which suggests for more thorough time formatting, but not for improved correctness. Some details on how these magic words are calculated would help when trying to determine whether that's actually necessary. -PFWOz (talk) 19:07, 31 December 2018 (UTC)

False example for PAGENAME encoding of apostrophe
Help:Magic words shows an example which is currently false:

The code actually produces "No translation". Numeric char encoding to &amp;#39; does happen but #switch (same with #ifeq) will match &amp;#39; to any of ' (a pure apostrophe), &amp;apos; and &amp;#39;. The first match in the switch is chosen. "Show changes" on  will show that   produces L&amp;#39;Aquila if page name is "L'Aquila". It can cause problems in other situations. PrimeHunter (talk) 12:33, 12 January 2019 (UTC)

It is a wiki...

Anyway, when it was written it was 100% right, but things in the parser have changed since then, which is easy enough to prove by installing an older mediawiki version, or finding a public wiki, e.g. on wikia's wikis it shows "L&#39;Aquila". The only way to keep the example always true is to make it dynamic by identifying a parser function or lua function that will always match its behaviour, and transcluding that.

The rest of the comment is rather irrelevant, as far as the misguided "switch" parser function is concerned. It mostly follows the rules of programming languages, if multiple values match then it picks the first one, and that's clearly documented even for non-programmers.

Also, the warning comes with bug reports, so if any of them gets fixed it affects the example. So technically it isn't false.

197.218.85.83 11:07, 13 January 2019 (UTC)

Other magic words
Where can I find magic words such as and  ? CaiusSPQR (talk) 01:31, 23 January 2019 (UTC)


 * These are included with Extension:Wikibase. Took me a couple hours to figure out, but it seems you need to add   to your localsettings.php after setting up Wikibase. This does add "shortdesc" to the list of parser function hooks in Special:Version, but I have yet to see it actually work as  , is still recognized as a template on my own wiki for some reason. Somebody should really document this properly somewhere. - ElementalLagomorph (talk) 22:52, 29 January 2019 (AEDT)

Get number of subpages of a mainpage
I have a page with multiple subpages attached to it. Is it possible to get the count of subpages and display that information? Extarys (talk) 05:06, 19 February 2019 (UTC)
 * I don’t know of any core function, but I should be possible using an extension (I don’t know whether such extension exists currently). —Tacsipacsi (talk) 18:22, 19 February 2019 (UTC)

Does an empty defaultsort make sense or can it be deleted? I found it on may pages in Commons. --Aschroet (talk) 05:07, 5 April 2019 (UTC)