Wikipedia talk:MediaWiki/DeveloperMemo/December2009

Help link in search
Regarding the request for a help link message on the search page: I was involved in adding the help links to the old search page and to Special:Contributions. I took a look and I think I know how to add it to the new search. No need to involve the devs for that, we enwp admins can fix it. I will take a closer look at it sometime during the next few days, perhaps even later today. (Noted at the top in my to-do list.)

--David Göthberg (talk) 10:52, 5 December 2009 (UTC)

Feature request: empty parameters
With help of  syntax we may process case, when parameter isn't defined. Unfortunately, there is no similarly simple way for checking if parameter is empty, we should bother with #if and this is very common piece of code. Consequently, what about introducing simpler way for checking if parameter is empty (or not defined)? For example ?

PS: Examples, how we get empty parameters:

AVBtalk 22:54, 7 December 2009 (UTC)


 * I agree, a syntax like " " would be very useful.
 * Meanwhile you might be interested in ifparadef and ifparadef full which provides that functionality.
 * --David Göthberg (talk) 10:11, 8 December 2009 (UTC)


 * empty but defined - I think, such test is rarely used, in contrary to "empty OR NOT defined" (or, more correctly, "not defined or empty"). you might be interested - no, my idea is to reduce code length and reduce amount of parentheses. Using additional templates not better than using #if directly. PS: ifparadef will not work correctly if tested parameter equal to "¬". AVBtalk 21:07, 8 December 2009 (UTC)


 * Ah, it wasn't clear to me from your text above what you meant. Okay, so what you want is this: " ". And I assume you mean we should only feed one of the alternate parameters, since feeding both would be kind of strange since they are contradictory. That would be useful too, but a bit strange. And not as flexible as what I suggested. Note that we do check "empty but defined" in a lot of templates, but yeah checking "not defined or empty" is more common. Still, since your version is contradictory and not as flexible, I would prefer my version.
 * And regarding the "¬" value, well if you are concerned about that then there is the the ifparadef full that doesn't have that problem, but is a bit more complex to use. But as you say, you want to detect "not defined or empty", and then I agree that then one simply should use an if-case. But also as you say, it would be nice with a more compact notation than the if-case.
 * --David Göthberg (talk) 22:12, 8 December 2009 (UTC)


 * not as flexible - goal isn't flexibility, but simplicity. Checking for empty (in sense "not defined or empty") parameters is too common, much more common (at least, in my practice), than only "not defined" or "defined and empty". PS: it's not nice that there is no way to #if-check for not defined parameter. Trying to use signatures (like "¬" in "ifparadef") may help, but this is not bullet-prof. AVBtalk 02:51, 9 December 2009 (UTC)


 * I see your point, and your are right that your case is the more common. Still, it feels weird to use a contradictory notation, so I think I still slightly prefer my version, but just very slightly. I'd be pretty happy with your version too, so this is not a vote against your version.
 * And regarding testing for not defined parameters: There are some bulletproof ways to do it. Here are two ways to do it:


 * But as both you and I know, most template coders don't have the skills to come up with that code and it is somewhat bulky. So it would be nice to have some shorter notation for it.
 * Oh, I will document these methods over at ifparadef full so we can point people there when needed. And so people who find that template can choose to hardcode it if they prefer that.
 * --David Göthberg (talk) 16:12, 9 December 2009 (UTC)


 *  #ifeq: |   - yes, you right, nice trick. AVBtalk 19:17, 10 December 2009 (UTC)

pages for wrong URLs
When I (manually) type/open wrong URL (ie. URL for non-existing or deleted topic, for example - http://en.wikipedia.org/wiki/Testtesttest), then we shown empty page with only logs and link to create such page (which usually more noticeable, than link for search). The more so, link to search tries to search over texts, not only headers. All this bothering gives for some users reason to create duplicate articles (which only slightly differs from already existing articles headers) or produce tons of useless redirects (often with spell errors).

My proposal: when I enter wrong URL or click by red link, I should get page with logs and list of similar headers with link to create only at bottom. For example, for http://en.wikipedia.org/wiki/Epic_record I should get link Epic Records. Links should indicate when they are disambigs and which target is for redirect. Similarity should, for example, include ignorance for spaces. For example, for http://en.wikipedia.org/wiki/I.V.Sasi I should see links I. V. Sasi, I.V. Sasi and I V Sasi with indication, that last links redirect to I. V. Sasi. Also, similarity should be configurable per local wikis: for example, Russian wikipedia requires to ignore difference between "" and «» quotes - «» should be used in headers, but, unlike "", they hard to enter from keyboard.

As result, we should get simplification for users (they get simpler and faster way to find topics) and less garbage in wikipedias (not need to create page or redirect if you immediately see link for your topic). AVBtalk 03:22, 9 December 2009 (UTC)

include new redirects into watch lists
When page is move/renamed, users, who watch page, get into watch list both new and old names. When someone just creates redirect, it not seen for other users, who watch target page. This is illogical, especially redirect sometime used for vandalism. My proposal: redirect should be automatically included into watch lists of those users, who watch target page. This relates either to moving page, creating new redirect, editing redirect with changing target or including some page into watch list (in this case watch list should include also all redirects, similarly as it gets talk page together with main page). AVBtalk 03:29, 9 December 2009 (UTC)

bug? table with margin
If I want to shift table, I may use ":":
 * {|class="standard"

But if after ":" present space, this broke table:
 * cell
 * }
 * {|class="standard"

AVBtalk 19:14, 10 December 2009 (UTC)
 * cell
 * }

Bug? Wrong quotes in FULLPAGENAME
In "Weird Al" Yankovic insert next code:



This code should produce link for test subsection below. Unfortunately, link after this code doesn't work, because FULLPAGENAME instead quotes produces tag &amp;quot;, which encoded by "anchorencode" into .26quot.3B:


 * http://en.wikipedia.org/wiki/Wikipedia_talk:MediaWiki/DeveloperMemo/December2009#.26quot.3BWeird_Al.26quot.3B_Yankovic

This bug I found in Russian wikipedia - there is template, which gives link for section, where discussed page, and header of this section includes page name. One our technician suggests to add "titleparts" workaround to fix name after FULLPAGENAME:



With this code link contain correct .22 for quotes:


 * http://en.wikipedia.org/wiki/Wikipedia_talk:MediaWiki/DeveloperMemo/December2009#.22Weird_Al.22_Yankovic

I not sure, if given workaround not introduces other unwanted side effects. AVBtalk 22:38, 10 December 2009 (UTC)

"Weird Al" Yankovic
This is test section to illustrate code from section above. AVBtalk 22:38, 10 December 2009 (UTC)

АБВГДЕЖ ΑΒΓΔΕΖΗΘ أبجدية عربية
Another test section, with Cyrillic, Greek and Arabic text in it.

--David Göthberg (talk) 09:25, 11 December 2009 (UTC)

Response
There's no bug. Instead it is much simpler, you should not use anchorencode. Here's what you should put in the "Weird Al" Yankovic article to link to the section above:

Wikipedia talk:MediaWiki/DeveloperMemo/December2009

Just to make sure I tested it, and it works fine.

When you have technical problems like this, then I suggest you first bring them up at Village pump (technical). Since often we already have a solution or know more about it and the Village Pump is watched by many more users.

--David Göthberg (talk) 02:07, 11 December 2009 (UTC)


 * There's no bug - anchorencode+titleparts - works, anchorencode+plain string - works, anchorencode+FULLPAGENAME - not. No bug? not use anchorencode - my example above with just FULLPAGENAME is reduced test code; complete code also includes template parameters, which may contain any characters. Village pump - well, when I will have question, I bring it there. AVBtalk 05:35, 11 December 2009 (UTC)


 * Again, you should not use anchorencode since " " itself already does all the encoding we need. Here are some examples with both template code and problematic characters like spaces and "ö":

User:Davidgothberg

São Paulo

Wikipedia talk:MediaWiki/DeveloperMemo/December2009
 * User:Davidgothberg
 * São Paulo
 * Wikipedia talk:MediaWiki/DeveloperMemo/December2009
 * As you can see if you move the mouse pointed over that anchor it is encoded to "David_G.C3.B6thberg" automatically by Mediawiki, and it correctly takes you to the "David Göthberg" section of my user page. And it has the added benefit that it doesn't show "David_G.C3.B6thberg" as the link text, but instead the plain "David Göthberg". The "São Paulo" link and the link with Cyrillic+Greek+Arabic text also works. I have worked a lot with special characters in anchors like this, since I am from Sweden and speak several languages, and I have coded several templates that use anchors. (See for instance sec link and sec link auto.)
 * --David Göthberg (talk) 09:25, 11 December 2009 (UTC)


 * AVB: I did some more thinking and now I see your problem. You used the wrong example so it threw me off. For " " you still should not use anchorencode. But for " " we need anchorencode, and then your bug becomes visible. Like this:

1:

2:

3:


 * If you use the above links when in the article "Weird Al" Yankovic, then the first link should not work (and it doesn't) since it needs to be anchorencoded, the second link should work but doesn't work due to your bug, but the third link works. So yes, it is a bug. But you must use " " to illustrate that bug. But we probably never need to use " " for anchor links within or between wikiprojects. So your bug should almost only be a problem when linking to external web sites. But using " " in an anchor link to an external web site is probably very unlikely. But it is a problem when making links for the secure server, and it could perhaps be a problem in some weird case when linking to the toolserver.
 * --David Göthberg (talk) 10:07, 11 December 2009 (UTC)


 * For " " you still should not use anchorencode - ok, thanks, this simplifies our template. Still, is there reasons, why anchorencode+FULLPAGENAME case shouldn't be fixed (because other users MAY use such combination and because you yourself see applications like secure server links)? AVBtalk 19:23, 11 December 2009 (UTC)


 * Right, it is a bug, and it can sometimes be a problem, so it should be reported. I did a search of bugzilla and it seems no one has reported this bug before. But I found a number of other bug reports regarding the link and anchor handling. I had no idea there were so many different bugs with the links and anchors...
 * --David Göthberg (talk) 11:19, 13 December 2009 (UTC)

Special:Watchlist and parameters
AFAIK, Special:Watchlist URL (http://en.wikipedia.org/w/index.php?title=Special:Watchlist) allows only &days= parameter to specify how many days should be shown in watch list. I want finer resolution (for example, &hour=0.5 is more convenient, than &days=0.02083) and possibility to specify starting time (for example, &offset=20091211) - this especially important when watch list reach limits (in Russian wikipedia this is 1000 edits with enhanced list) and I can't get otherwise all edits from previous list read. AVBtalk 05:50, 11 December 2009 (UTC)

context with quotes
(In Russian: ru:ВП:Форум/Архив/Технический/2009/06)

AVBtalk 10:53, 19 December 2009 (UTC)
 * Article: ru:Heroes of Might and Magic 3½: In the Wake of Gods
 * Search context: "создаваемый тогда единолично С. Сальниковым" - sentence from article above
 * Searching without quotes: - found.
 * Searching with quotes: - not found.

tags broke words
(First report in Russian: ru:ВП:Форум/Архив/Технический/2009/06)

Article ru:Оксид титана(IV) contains formulae "2KHCO3". Searching for "2KHCO3" founds nothing, but with space search works and shows formulae broken (as "2KHCO 3"). AVBtalk 10:53, 19 December 2009 (UTC)

alone hyphen in search context
(First report in Russian: ru:ВП:Форум/Архив/Технический/2009/07)

Searching белый дом ("white house" in Russian) and белый, дом works, but белый - дом - not. As I understand, mediawiki counts this as exclusion for "дом", although there is space after hyphen. For compare, search in google. AVBtalk 10:53, 19 December 2009 (UTC)

feature request: string functions
We (users of Russian wikipedia) need string functions. For example, template "cite web" combines author= and title= and there should be dot in between. If there will be always added dot, we will get something like "Author Jr.. Name", without adding dot we will get "James Joyce Ulysses". Consequently, template should analyze tail characters for present punctuation and add dot only if there is no such. Without string functions, we develop very ugly templates (with high engine load!) like ru:Template:Str len, ru:Template:Str find, ru:Template:Str right, etc. PS: See also our Village pump: ru:ВП:Ф-Т. AVBtalk 11:32, 22 December 2009 (UTC)

feature request: separate direct and indirect links in special:whatlinkshere
Special:whatlinkshere shows all links and inclusions for page without differentiate for direct and indirect links and inclusions. For example, Special:WhatLinksHere/Template:Str len shows that Ankara includes this template, but it NOT uses it, it uses other templates, which use "str len". Another example, Special:WhatLinksHere/Athlon shows, that Am5x86 links to this page, although link in Am5x86 is indirect, through Template:AMD processors.

I request, that whatlinkshere should somewhat indicate, that link or inclusion is indirect, and should allow to exclude ndirect lnks from view.

PS: And whatlinks here list itself should be somewhat sorted, for example, by alphabet. Redirects should be listed after (or before) other links. AVBtalk 11:48, 22 December 2009 (UTC)

feature request: handling wrong parameters
When we want to handle wrong number of unnamed parameters (for example, if 3-param template called with 4+ parameters), we my check if is defined. But I don't know how to handle wrong named parametes (for example, someone my mistype "acessdate" instead "accessdate").

Proposal: add some possibility to check. Possible implementation: variable with number of named parameters. In this case we may use next code: AVBtalk 10:25, 25 December 2009 (UTC)

bugs: empty and numeric ref-name
MediaWiki parser behaves strangely: it tolerant to empty ref-name and rejects numerc ref name: "), then drop-down list should show list of sections in consequent page. AVBtalk 22:38, 12 January 2010 (UTC)