19.536
Bearbeitungen
(- Modul:Queries) |
(switch com.getMonthnr() zu kal.month_numbers[]) |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
local str = require("Modul:String") | local str = require("Modul:String") | ||
local wik = require("Modul:Wiki") | local wik = require("Modul:Wiki") | ||
local kal = require("Modul:Kalender") | |||
local lfd = require("Modul:LinkFormDatum") | local lfd = require("Modul:LinkFormDatum") | ||
| Zeile 149: | Zeile 149: | ||
-- mw.log("smwDate2SortIndex(" .. date .. ")") | -- mw.log("smwDate2SortIndex(" .. date .. ")") | ||
-- Datum in Index wandeln | -- Datum in Index wandeln | ||
-- Bsp.: 23 | -- Bsp.: 23 April 1989 => 19890423 | ||
-- Konsolenzeile zum Debuggen: | -- Konsolenzeile zum Debuggen: | ||
-- =p.smwDate2SortIndex("2000") | -- =p.smwDate2SortIndex("2000") | ||
| Zeile 156: | Zeile 156: | ||
local sort_index = "" | local sort_index = "" | ||
local date=str.split2(date, " ") | local date=str.split2(date, " ") | ||
if #date == 1 then | if #date == 1 then -- nur Jahr vorhanden | ||
sort_index = tostring(date[1]) | sort_index = tostring(date[1]) | ||
if vonbis == "von" then | if vonbis == "von" then | ||
| Zeile 163: | Zeile 163: | ||
sort_index = sort_index .. "0000" | sort_index = sort_index .. "0000" | ||
end | end | ||
elseif #date == 2 then | elseif #date == 2 then -- nur Monat + Jahr vorhanden | ||
sort_index = tostring(date[2]) .. string.format("%02d", | sort_index = tostring(date[2]) .. string.format("%02d", kal.month_numbers[date[1]]) | ||
if vonbis == "von" then | if vonbis == "von" then | ||
sort_index = sort_index .. "99" | sort_index = sort_index .. "99" | ||
| Zeile 170: | Zeile 170: | ||
sort_index = sort_index .. "00" | sort_index = sort_index .. "00" | ||
end | end | ||
elseif #date == 3 then | elseif #date == 3 then -- komplettes Datum vorhanden | ||
sort_index = tostring(date[3]) .. string.format("%02d", | sort_index = tostring(date[3]) .. | ||
string.format("%02d", kal.month_numbers[date[2]]) .. | |||
string.format("%02d", tonumber(string.match(date[1], "%d*"))) | |||
end | end | ||
sort_index = tonumber(sort_index) or 0 | sort_index = tonumber(sort_index) or 0 | ||