82.367
Bearbeitungen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| (14 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 3: | Zeile 3: | ||
local c = require("Modul:Common") | local c = require("Modul:Common") | ||
local lfd = require("Modul:LinkFormDatum") | local lfd = require("Modul:LinkFormDatum") | ||
local lsd = require("Modul:LinkSubformDatum") | |||
function p.Eintrag(frame) | |||
local title = mw.title.getCurrentTitle().text | |||
local daterange = frame.args[1] | |||
local text = frame.args[2] or "" | |||
local option = frame.args[3] | |||
local thema = frame.args["Thema"] or "Ereignis" | |||
local year = nil | |||
if c.istJahreszahl(title) then | |||
year = title | |||
end | |||
local data = p.dateParser(daterange, year) | |||
local ds = '[[' .. data['Starttag'] .. ']]' | |||
if not year then | |||
ds = ds .. ' [[' .. data['Startjahr'] .. ']]' | |||
end | |||
if data['Enddatum'] then | |||
ds = ds .. " - [[" .. data['Endtag'] .. "]]" | |||
if not year then | |||
ds = ds .. " [[" .. data['Endjahr'] .. "]]" | |||
end | |||
end | |||
data['Beschreibung'] = text | |||
data['Thema'] = thema | |||
mw.smw.subobject(data) | |||
if option == "nodate" then | |||
return text | |||
end | |||
return ds .. ': ' .. text | |||
end | |||
function p.dateParser(s, year) | function p.dateParser(s, year) | ||
local start_date, end_date = p.splitDateString(s, year) | local start_date, end_date = p.splitDateString(s, year) | ||
start_date, end_date = p.completeDates(start_date, end_date, year) | start_date, end_date = p.completeDates(start_date, end_date, year) | ||
local sdf = lfd.humanToFormDate(start_date) | |||
local data = { | |||
['Startdatum'] = sdf, | |||
['Startjahr'] = lsd.getYear(sdf), | |||
['Starttag'] = lsd.getMonthday(sdf) | |||
} | |||
if end_date then | |||
local edf = lfd.humanToFormDate(end_date) | |||
data['Enddatum'] = edf | |||
data['Endjahr'] = lsd.getYear(edf) | |||
data['Endtag'] = lsd.getMonthday(edf) | |||
end | |||
mw.logObject(data) | |||
return data | |||
end | end | ||