Bürokraten, Oberflächenadministratoren, SMW-Administratoren, SMW-Kuratoren, SMW-Editoren, Oversighter, Administratoren, Widget-Bearbeiter
215.197
Bearbeitungen
Keine Bearbeitungszusammenfassung |
(Namenskonvention für Modul-Importe) |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
local str = require("Modul:String") | local str = require("Modul:String") | ||
local | local srf = require("Modul:Subrefs") | ||
local | local com = require("Modul:Common") | ||
local lfd = require("Modul:LinkFormDatum") | local lfd = require("Modul:LinkFormDatum") | ||
local lsd = require("Modul:LinkSubformDatum") | local lsd = require("Modul:LinkSubformDatum") | ||
| Zeile 13: | Zeile 13: | ||
local thema = frame.args["Thema"] or "Ereignis" | local thema = frame.args["Thema"] or "Ereignis" | ||
local year = nil | local year = nil | ||
if | if com.istJahreszahl(title) then | ||
year = title | year = title | ||
end | end | ||
local data = p.dateParser(daterange, year) | local data = p.dateParser(daterange, year) | ||
local ds = '' | local ds = '' | ||
if not | if not com.isEmpty(data['Starttag']) then | ||
ds = '[[' .. data['Starttag'] .. ']]' | ds = '[[' .. data['Starttag'] .. ']]' | ||
end | end | ||
| Zeile 37: | Zeile 37: | ||
local t | local t | ||
if option == "nodate" then | if option == "nodate" then | ||
t = | t = srf.subrefs(text) | ||
else | else | ||
t = ds .. ': ' .. | t = ds .. ': ' .. srf.subrefs(text) | ||
end | end | ||
return frame:preprocess(t) | return frame:preprocess(t) | ||
| Zeile 72: | Zeile 72: | ||
local sd = str.split(start_date, ' ') | local sd = str.split(start_date, ' ') | ||
if not | if not com.isEmpty(end_date) then | ||
-- Wenn ein Enddatum gegeben ist | -- Wenn ein Enddatum gegeben ist | ||
local ed = str.split(end_date, ' ') | local ed = str.split(end_date, ' ') | ||
mw.logObject(ed) | mw.logObject(ed) | ||
if | if com.len(ed) == 2 then | ||
-- Wenn das Enddatum kein Jahr enthält, füge es aus year hinzu | -- Wenn das Enddatum kein Jahr enthält, füge es aus year hinzu | ||
ed[3] = year | ed[3] = year | ||
end_date = end_date .. " " .. ed[3] | end_date = end_date .. " " .. ed[3] | ||
end | end | ||
if | if com.len(sd) == 2 then | ||
-- Wenn das Startdatum kein Jahr enthält, hole es von Enddatum | -- Wenn das Startdatum kein Jahr enthält, hole es von Enddatum | ||
start_date = start_date .. " " .. ed[3] | start_date = start_date .. " " .. ed[3] | ||
elseif | elseif com.len(sd) == 1 then | ||
-- Startdatum enthält weder Monat noch Jahr, hole sie von Enddatum | -- Startdatum enthält weder Monat noch Jahr, hole sie von Enddatum | ||
start_date = start_date .. " " .. ed[2] .. " " .. ed[3] | start_date = start_date .. " " .. ed[2] .. " " .. ed[3] | ||
| Zeile 93: | Zeile 93: | ||
return start_date, end_date | return start_date, end_date | ||
end | end | ||
if | if com.len(sd) == 2 then | ||
-- Wenn das Startdatum kein Jahr enthält, hole es aus year | -- Wenn das Startdatum kein Jahr enthält, hole es aus year | ||
sd[3] = year | sd[3] = year | ||
start_date = start_date .. " " .. sd[3] | start_date = start_date .. " " .. sd[3] | ||
elseif | elseif com.len(sd) == 1 then | ||
sd[3] = year | sd[3] = year | ||
start_date = start_date .. " " .. sd[3] | start_date = start_date .. " " .. sd[3] | ||
| Zeile 109: | Zeile 109: | ||
local dates = str.split(s, "-") | local dates = str.split(s, "-") | ||
-- Wenn splitten mit "-" nur ein Ergebnis bringt, splitte mit "bis" | -- Wenn splitten mit "-" nur ein Ergebnis bringt, splitte mit "bis" | ||
if | if com.len(dates) == 1 then | ||
dates = str.split(s, "bis") | dates = str.split(s, "bis") | ||
end | end | ||
Bearbeitungen