82.367
Bearbeitungen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| (13 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 4: | Zeile 4: | ||
local lfd = require("Modul:LinkFormDatum") | local lfd = require("Modul:LinkFormDatum") | ||
local lsd = require("Modul:LinkSubformDatum") | 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 = { | local data = { | ||
['Startdatum'] = | ['Startdatum'] = sdf, | ||
['Startjahr'] = lsd.getYear( | ['Startjahr'] = lsd.getYear(sdf), | ||
['Starttag'] = lsd. | ['Starttag'] = lsd.getMonthday(sdf) | ||
} | } | ||
if end_date then | if end_date then | ||
local edf = lfd.humanToFormDate(end_date) | |||
data['Enddatum'] = edf | |||
data['Endjahr'] = lsd.getYear(edf) | |||
data['Endtag'] = lsd.getMonthday(edf) | |||
end | end | ||
return | mw.logObject(data) | ||
return data | |||
end | end | ||
| Zeile 68: | Zeile 99: | ||
return dates[1], dates[2] | return dates[1], dates[2] | ||
end | end | ||
return p | return p | ||