Modul:Chronik: Unterschied zwischen den Versionen

keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
local p = {}
local p = {}
local c = require("Modul:Common")
local c = require("Modul:Common")
local lf = require("Modul:LinkFormDatum")
local lfd = require("Modul:LinkFormDatum")
local ls = require("Modul:LinkSubformDatum")
local lsd = require("Modul:LinkSubformDatum")


function p.Eintrag(frame)
function p.Eintrag(frame)
Zeile 15: Zeile 15:
["Artikel"] = fulltitle
["Artikel"] = fulltitle
}
}
-- Wenn das Lemma eine Jahreszahl ist, merken
-- Wenn das Lemma eine Jahreszahl ist, merken
if istJahreszahl(titlename) then
if istJahreszahl(titlename) then
Zeile 21: Zeile 20:
     end
     end
     local data_date = dateParsing(args[1], year)
     local data_date = dateParsing(args[1], year)
     local all_data=merge_tables(data, data_date)
     local all_data = merge_tables(data, data_date)
return data_date["Startdatum"] .. ": " .. args[2] .. '<br>' ..
return data_date["Startdatum"] .. ": " .. args[2] .. '<br>' ..
tableToString(all_data)
tableToString(all_data)
Zeile 28: Zeile 27:
function dateParsing(s, year)
function dateParsing(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(s, '-')
-- Wenn s eine Zeitspanne ist, teile bei "-" oder "bis"
local dates=split(s, '-')
if len(d) == 1 then
if len(d) == 1 then
d=split(s, 'bis')
dates=split(s, 'bis')
end
end
local sds = checkYear(d[0], year)
-- Ist eine Zeitspanne wie "3. bis 5. Mai" angegeben, kopiere Monat aus Enddatum
local sds = checkYear(dates[0], year)
local sd=human_to_form_date(d[0])
local sd=human_to_form_date(d[0])
local data = {
local data = {
-- Erstmal das Startdatum schreiben
-- Erstmal das Startdatum schreiben
["SDstring"] = d[0],
["SDstring"] = dates[0],
["Startdatum"] = sd,
["Startdatum"] = sd,
["Startjahr"] = get_year(sd),
["Startjahr"] = get_year(sd),
Zeile 46: Zeile 50:
local ed=nil
local ed=nil
if len(d) == 2 then
if len(dates) == 2 then
-- War eine Zeitspanne angegeben gibt es ein Endatum
-- War eine Zeitspanne angegeben gibt es ein Endatum
ed=human_to_form_date(d[1])
ed=human_to_form_date(d[1])
82.367

Bearbeitungen