Wikipedia talk:MediaWiki/DeveloperMemo/December2009
![]() | This page is part of the Wikipedia:MediaWiki/DeveloperMemo. Topics should be grouped logically in sections and subsections. Where, at the end of the month, it's not clear yet on a particular issue whether a request or question has consensus for inclusion in the current memo, the relevant discussion may be transferred to the next month's discussion page. The Memo itself should be kept as brief and precise as possible - detailed explanation should be elsewhere (if necessary, on a subpage). |
Help link in search
[edit]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
[edit]With help of {{{param|alternate}}}
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 ({{#if: {{{1|}}}|non-empty|empty or not defined}}
) 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 {{{param||alternate}}}
?
PS: Examples, how we get empty parameters:
{{infobox
| name = bla-bla
| birth = bla-bla
| death =
}}
<!-- call for "sub-template" template from another template -->
{{sub-template|param1={{{1|}}}}}
AVBtalk 22:54, 7 December 2009 (UTC)
- I agree, a syntax like "
{{{param|'not defined'|'empty but defined'}}}
" 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: "
{{{param|'not defined'|'not defined or empty'}}}
". 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)
- Ah, it wasn't clear to me from your text above what you meant. Okay, so what you want is this: "
- 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:
{{#ifeq: {{{input|x}}} | {{{input|y}}} | Defined. (Empty or has data.) | Not defined. }} {{#switch: {{{input|x}}}{{{input|y}}} | xy = Not defined. | = Empty. | #default = Has data. }}
- 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: {{{input|x}}} | {{{input|y}}} - yes, you right, nice trick. AVBtalk 19:17, 10 December 2009 (UTC)
pages for wrong URLs
[edit]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
[edit]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
[edit]If I want to shift table, I may use ":":
:{|class="standard"
| cell
|}
cell
But if after ":" present space, this broke table:
: {|class="standard"
| cell
|}
cell
AVBtalk 19:14, 10 December 2009 (UTC)
Bug? Wrong quotes in FULLPAGENAME
[edit]In "Weird Al" Yankovic insert next code:
[[Wikipedia talk:MediaWiki/DeveloperMemo/December2009#{{anchorencode:{{FULLPAGENAME}}}}]]
This code should produce link for test subsection below. Unfortunately, link after this code doesn't work, because FULLPAGENAME instead quotes produces tag ", which encoded by "anchorencode" into .26quot.3B:
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:
[[Wikipedia talk:MediaWiki/DeveloperMemo/December2009#{{anchorencode:{{#titleparts:{{FULLPAGENAME}}}}}}]]
With this code link contain correct .22 for quotes:
I not sure, if given workaround not introduces other unwanted side effects. AVBtalk 22:38, 10 December 2009 (UTC)
"Weird Al" Yankovic
[edit]This is test section to illustrate code from section above. AVBtalk 22:38, 10 December 2009 (UTC)
АБВГДЕЖ ΑΒΓΔΕΖΗΘ أبجدية عربية
[edit]Another test section, with Cyrillic, Greek and Arabic text in it.
--David Göthberg (talk) 09:25, 11 December 2009 (UTC)
Response
[edit]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#{{FULLPAGENAME}}]]
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 Wikipedia: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 "ö":
- Again, you should not use anchorencode since "
[[User:Davidgothberg#{{#if:x|David Göthberg}}]] [[São Paulo#S{{#if:x | {{{1|ã}}} }}o Pau{{{2|lo}}} Art Bienal]] [[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: [http://en.wikipedia.org/wiki/Wikipedia_talk:MediaWiki/DeveloperMemo/December2009#{{FULLPAGENAME}} ] 2: [http://en.wikipedia.org/wiki/Wikipedia_talk:MediaWiki/DeveloperMemo/December2009#{{anchorencode:{{FULLPAGENAME}} }} ] 3: [http://en.wikipedia.org/wiki/Wikipedia_talk:MediaWiki/DeveloperMemo/December2009#{{anchorencode:{{#titleparts:{{FULLPAGENAME}} }} }} ]
- 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 "{{FULLPAGENAME}}
" 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
[edit]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)
Search bugs?
[edit]context with quotes
[edit](In Russian: ru:ВП:Форум/Архив/Технический/2009/06#поиск глючит)
- Article: ru:Heroes of Might and Magic 3½: In the Wake of Gods
- Search context: "создаваемый тогда единолично С. Сальниковым" - sentence from article above
- Searching without quotes: [1] - found.
- Searching with quotes: [2] - not found.
AVBtalk 10:53, 19 December 2009 (UTC)
tags broke words
[edit](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
[edit](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
[edit]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
[edit]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
[edit]When we want to handle wrong number of unnamed parameters (for example, if 3-param template called with 4+ parameters), we my check if {{{4}}} 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:
<!-- template, which may called with title=, url= and date= parameters -->
{{#ifeq: {{{NUMPARAMS}}}
|{{#expr: {{#ifeq: {{{title|x}}}|{{{title|y}}}|1|0}}+
{{#ifeq: {{{url |x}}}|{{{url |y}}}|1|0}}+
{{#ifeq: {{{date |x}}}|{{{date |y}}}|1|0}}}}
|all fine
|wrong parameters used
}}
AVBtalk 10:25, 25 December 2009 (UTC)
bugs: empty and numeric ref-name
[edit]MediaWiki parser behaves strangely: it tolerant to empty ref-name and rejects numerc ref name:
<ref name="">text 1</ref>
[1]<ref name="">text 2</ref>
[2]<ref name="1234">1234</ref>
Cite error: The<ref>
tag name cannot be a simple integer (see the help page).
AVBtalk 12:37, 1 January 2010 (UTC)
- I filed this one as bugzilla:22850 —TheDJ (talk • contribs) 14:06, 16 March 2010 (UTC)
feature request: more details in service pages
[edit]- Add link "contributions" for users at http://en.wikipedia.org/w/index.php?title=special:Contributions&contribs=newbie&target=newbies similarly as at Special:NewPages.
- At Special:LinkSearch should be added links "history" for pages.
- At Special:Contributions will be very useful indication of diff size (some vandals make multimegabyte edits, viewing which is not very loved by browsers, especially in AJAX-scripts).
AVBtalk 00:13, 7 January 2010 (UTC)
feature request: search for transliterations
[edit]Non-English users should sometime switch keyboard layout from English to local and vice versa. As result, some search context in search field typed in wrong layout. For example, instead "Путин" ("Putin" in Russian) typed "Genby". In case, if exact prefix match not found, drop down list with matches under search field should try to show result of transliterated search (in ru-wiki, because there is no match for "genby", should be searched prefix "путин"). Transliteration table(s) for local wikis should be filled by local admins.
Also, will be fine, if in case of no matches drop down list will show result of inexact search (for example, ignoring extra spaces or missing spaces around punctuation; different quote types; etc.). See also #pages for wrong URLs above. AVBtalk 00:24, 7 January 2010 (UTC)
bugs: match list
[edit]Two days ago in ru-wiki was changed match list, which shown in drop down list under search field. Unfortunately, there is many drawbacks in new algorithms. AVBtalk 22:29, 12 January 2010 (UTC)
match list: no alphabet sorting
[edit]Entries shown in completely random order. AVBtalk 22:29, 12 January 2010 (UTC)
match list: no required entries
[edit]special:prefixindex/ASCII- and special:prefixindex/ascii- shows:
ASCII-Art ASCII-art ASCII-арт ASCII-графика ASCII-искусство
and
Ascii-art
but when I enter in search field "ascii-", drop-down list shows only
ASCII ASCII-графика ASCII Media Works ASCII R800 ASCIIZ ASCII
but neither "ASCII-Art", "ASCII-art", "ASCII-арт", "ASCII-искусство". AVBtalk 22:29, 12 January 2010 (UTC)
match list: punctuation substitution
[edit]When I enter
- Телеканал "р
list shows only two entries:
Телеканал Россия Телеканал "Россия"
but not "Телеканал «Россия»" (which is preferable over Телеканал "Россия"). AVBtalk 22:29, 12 January 2010 (UTC)
feature requrest: sections in match list
[edit]When I enter prefix in search field and then # (for example, "Wikipedia talk:MediaWiki/DeveloperMemo/December2009#
"), then drop-down list should show list of sections in consequent page. AVBtalk 22:38, 12 January 2010 (UTC)