Modul:Jahr: Unterschied zwischen den Versionen
Aus FürthWiki
Keine Bearbeitungszusammenfassung |
K (Entfernte den Schutz von „Modul:Jahr“) |
||
| (34 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
local c = require( "Module:Common" ) | local c = require("Module:Common") | ||
function p.Zeitleiste( frame ) | function p.Zeitleiste(frame) | ||
local args = frame:getParent().args | |||
local title = mw.title.getCurrentTitle().text | |||
local year = tonumber(title) | |||
t = '<div class=" | |||
local t = '<div class="kopfleiste"><p>' .. | |||
jahrhundert(year) .. | |||
--Jahrzehnt(year).. Removed, because it only confuses | |||
jahre(year) .. | |||
'</p></div>' | '</p></div>' | ||
return t | return t | ||
end | end | ||
function jahre(year) | |||
return '[['..tostring(year-10)..'|◄]] | ' .. | |||
'[['..tostring(year-5)..']] | ' .. | |||
'[['..tostring(year-4)..']] | ' .. | |||
'[['..tostring(year-3)..']] | ' .. | |||
'[['..tostring(year-2)..']] | ' .. | |||
'[['..tostring(year-1)..']] | ' .. | |||
'[['..tostring(year)..']] | ' .. | |||
'[['..tostring(year+1)..']] | ' .. | |||
'[['..tostring(year+2)..']] | ' .. | |||
'[['..tostring(year+3)..']] | ' .. | |||
'[['..tostring(year+4)..']] | ' .. | |||
'[['..tostring(year+5)..']] | ' .. | |||
'[['..tostring(year+10)..'|►]]<br>' | |||
end | |||
function jahrzehnt(year) | |||
local ys = tostring(year) | |||
local decade = tonumber(string.sub(ys, -2, -2)) | |||
return '[['..tostring(year-10)..'|◄]] | '.. | |||
"'''"..tostring(decade).."0er Jahre''' | ".. | |||
'[['..tostring(year+10)..'|►]]<br>' | |||
end | |||
function jahrhundert(year) | |||
local ys = tostring(year) | |||
local century = tonumber(string.sub(ys, -4, -3)) + 1 | |||
local century_str = tostring(century)..". Jahrhundert" | |||
return '[['..tostring(year-100)..'|◄]] | '.. | |||
"[[:Kategorie:"..century_str.."|"..century_str.."]]".. | |||
"[[Kategorie:"..century_str.."]] | ".. | |||
'[['..tostring(year+100)..'|►]]<br>' | |||
end | |||
return p | return p | ||
Aktuelle Version vom 27. Oktober 2025, 08:03 Uhr
Seiten-Übersicht
| Hauptseite | Unterseiten | ||
|---|---|---|---|
| Allgemein | |||
| Faktenbox | Vorlagen | ||
| Formulare |
|
||
| Module | |||
| Abfrage | Vorlagen |
| |
| Formulare |
| ||
| Sonstige | |||
Doku
Das Modul "Jahr" wird über die Vorlage {{Jahr}} in einen Artikel eingebunden, welcher für ein Jahr steht (z. B. 333).
local p = {}
local c = require("Module:Common")
function p.Zeitleiste(frame)
local args = frame:getParent().args
local title = mw.title.getCurrentTitle().text
local year = tonumber(title)
local t = '<div class="kopfleiste"><p>' ..
jahrhundert(year) ..
--Jahrzehnt(year).. Removed, because it only confuses
jahre(year) ..
'</p></div>'
return t
end
function jahre(year)
return '[['..tostring(year-10)..'|◄]] | ' ..
'[['..tostring(year-5)..']] | ' ..
'[['..tostring(year-4)..']] | ' ..
'[['..tostring(year-3)..']] | ' ..
'[['..tostring(year-2)..']] | ' ..
'[['..tostring(year-1)..']] | ' ..
'[['..tostring(year)..']] | ' ..
'[['..tostring(year+1)..']] | ' ..
'[['..tostring(year+2)..']] | ' ..
'[['..tostring(year+3)..']] | ' ..
'[['..tostring(year+4)..']] | ' ..
'[['..tostring(year+5)..']] | ' ..
'[['..tostring(year+10)..'|►]]<br>'
end
function jahrzehnt(year)
local ys = tostring(year)
local decade = tonumber(string.sub(ys, -2, -2))
return '[['..tostring(year-10)..'|◄]] | '..
"'''"..tostring(decade).."0er Jahre''' | "..
'[['..tostring(year+10)..'|►]]<br>'
end
function jahrhundert(year)
local ys = tostring(year)
local century = tonumber(string.sub(ys, -4, -3)) + 1
local century_str = tostring(century)..". Jahrhundert"
return '[['..tostring(year-100)..'|◄]] | '..
"[[:Kategorie:"..century_str.."|"..century_str.."]]"..
"[[Kategorie:"..century_str.."]] | "..
'[['..tostring(year+100)..'|►]]<br>'
end
return p