In continuation of this, I started discussion on Commons Village Pump (http://commons.wikimedia.org/wiki/Commons:Village_pump#Should_categories_be_in_front_of_interwikis_or_other_way_around.3F ) about order of different parts of wikicode and Pywikipediabot attempts to standardize it. In particular I asked for opinions about preferred order of category and interwiki sections. If any of you are running Pywikipedia bots on Commons, I would like to invite you to this discussion.

 

Jarek T.

(user:Jarekt)

 

From: pywikipedia-l-bounces@lists.wikimedia.org [mailto:pywikipedia-l-bounces@lists.wikimedia.org] On Behalf Of Merlijn van Deen
Sent: Monday, November 28, 2011 2:46 AM
To: Pywikipedia discussion list
Subject: Re: [Pywikipedia-l] Interwiki.py on Commons

 

Hello Jarek,

 

On 28 November 2011 06:14, Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI@saic.com> wrote:

Apparently on Commons there is no standard if
categories go before interwikis or interwikis before categories, and
according to blocking admin, bots are expected to leave the page in the
order in which they found it.

(...) 

 

Is there any easy solution to this problem?

 

No, not really. At the moment, what happens is this: first, all interwiki links are removed from the page. Then, they are added to the bottom of the page.

 

This is - in general - a hard problem to work with. For instance, how should a page like

 

"blah text [[en:interwiki]] blah blah

 

[[fr:interwiki]]

[[nl:interwiki]]

 

[[category:cat]]"

 

be adapted? And how should a page like

 

"blah text

 

[[fr:interwiki]]

 

[[category:cat]]

 

[[nl:interwiki]]"

 

be adapted?

 

 

Changing the output to a different, but well-defined order is not that hard. Determining the correct order is. 

 

In this case, there are two options: thinking up some heuristic and implementing it, or doing some politics ('hey, if you don't *want* interwikis....'). 

 

If you want to work on the heuristic, the replaceLanguageLinks function in pywikibot/textlib.py is where you'd want to start.

 

Good luck (with either method ;-))!

 

Merlijn