Modul:Chronik: Unterschied zwischen den Versionen
Aus FürthWiki
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 27: | Zeile 27: | ||
function dateParsing(frame, s, year) | function dateParsing(frame, s, year) | ||
-- Parses a date down where s is the datestring and year can be nil or string | -- Parses a date down where s is the datestring and year can be nil or string | ||
local d=split('1 | local d=split('1. Dezember 2013', '-') | ||
local sd=human_to_form_date(d[0]) | local sd=human_to_form_date(d[0]) | ||
| Zeile 34: | Zeile 34: | ||
["Startjahr"] = get_year(sd), | ["Startjahr"] = get_year(sd), | ||
["Starttag"] = get_monthday(sd), | ["Starttag"] = get_monthday(sd), | ||
["jabba"] = #d, | |||
} | } | ||
| Zeile 42: | Zeile 43: | ||
data["Endjahr"] = get_year(ed) | data["Endjahr"] = get_year(ed) | ||
data["Endtag"] = get_monthday(ed) | data["Endtag"] = get_monthday(ed) | ||
end | end | ||
return data | return data | ||
Version vom 20. August 2025, 19:50 Uhr
local p = {}
local c = require("Modul:Common")
local lf = require("Modul:LinkFormDatum")
local ls = require("Modul:LinkSubformDatum")
function p.Eintrag(frame)
local args = frame.args
local title = mw.title.getCurrentTitle()
local titlename = title.text
local fulltitle = title.fullText
local data = {
["Beschreibung"] = args[2],
["Thema"] = "Ereignis",
["Artikel"] = fulltitle
}
-- Wenn das Lemma eine Jahreszahl ist, merken
local year = nil
if c.istJahreszahl(frame) == "true" then
year = titlename
end
local data_date = dateParsing(frame, args[1], year)
local all_data=merge_tables(data, data_date)
return tableToString(all_data) .. ': ' .. args[2]
end
function dateParsing(frame, s, year)
-- Parses a date down where s is the datestring and year can be nil or string
local d=split('1. Dezember 2013', '-')
local sd=human_to_form_date(d[0])
local data = {
["Startdatum"] = sd,
["Startjahr"] = get_year(sd),
["Starttag"] = get_monthday(sd),
["jabba"] = #d,
}
local ed=nil
if #d > 0 then
ed=human_to_form_date(d[1])
data["Enddatum"] = ed
data["Endjahr"] = get_year(ed)
data["Endtag"] = get_monthday(ed)
end
return data
end
return p