Permalink
Browse files

#89: Sort interlanguage links

  • Loading branch information...
1 parent 7c6f69e commit aeb514b8c1bdaebc0be458e5f116d21d69b20b02 @kynikos committed Jun 10, 2012
Showing with 6 additions and 3 deletions.
  1. +5 −3 src/modules/Interlanguage.js
  2. +1 −0 src/plugins/ArchWikiFixHeader.js
@@ -195,7 +195,7 @@ WM.Interlanguage = new function () {
};
this.updateLinks = function (lang, url, iwmap, source, oldlinks, newlinks) {
- var linkList = "";
+ var linkList = [];
for (var tag in newlinks) {
if (tag != lang) {
@@ -204,7 +204,7 @@ WM.Interlanguage = new function () {
for (var iw in iwmap) {
if (iwmap[iw].prefix == tag) {
if (WM.MW.getWikiPaths(iwmap[iw].url).api == link.api) {
- linkList += "[[" + tag + ":" + link.title + "]]\n";
+ linkList.push("[[" + tag + ":" + link.title + "]]\n");
}
else {
WM.Log.logWarning("On " + url + ", " + tag + " interlanguage links point to a different wiki than the others, ignoring them");
@@ -219,6 +219,8 @@ WM.Interlanguage = new function () {
}
}
+ linkList.sort();
+
var cleanText = "";
var textId = 0;
for (var l in oldlinks) {
@@ -241,7 +243,7 @@ WM.Interlanguage = new function () {
var firstChar = part2a.search(/[^\s]/);
var part2b = part2a.substr(firstChar);
- var newText = part1 + linkList + part2b;
+ var newText = part1 + linkList.join("") + part2b;
return newText;
};
@@ -126,6 +126,7 @@ WM.Plugins.ArchWikiFixHeader = new function () {
contentId = link.index + link.length;
}
if (iwlist.length) {
+ iwlist.sort();
header += iwlist.join("\n") + "\n";
}
tempcontent += content.substring(contentId);

0 comments on commit aeb514b

Please sign in to comment.