In continuation of this, I started discussion on Commons Village Pump ( ) 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.



From: [] On Behalf Of Merlijn van Deen
Sent: Monday, November 28, 2011 2:46 AM
To: Pywikipedia discussion list
Subject: Re: [Pywikipedia-l] on Commons


Hello Jarek,


On 28 November 2011 06:14, Tuszynski, Jaroslaw W. <> 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







be adapted? And how should a page like


"blah text








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/ is where you'd want to start.


Good luck (with either method ;-))!