Modul:Hiero/Cartouche
Zur Navigation springen
Zur Suche springen
Die Dokumentation für dieses Modul kann unter Modul:Hiero/Cartouche/Doku erstellt werden
--[=[ Hiero/Cartouche 2021-12-29
Module for Generating Serechs and Cartouches - Vertical and Horrizontal
Author: Vollbracht
* Cartouche.title(NameType, language)
* Cartouche.name(frame, NameType, code, symbol, border)
]=]
--Module globals
local p = {}
local Cartouche = {}
p.Title = function(frame)
if frame.args[1] == nil then return '' end
if frame.args[1] == '' then return '' end
return Cartouche.Title(frame.args[1], frame.args[2])
end
-- multi language title visible for readers
Cartouche.Title = function(NameType, language)
local list = {
de={Horus='[[Horusname]]',
Seth='[[Peribsen#Sethname statt Horusname|Sethname]]',
HorusSeth='Horus-Seth-Name',
Nebti='[[Nebtiname]]', Gold='[[Goldname]]', Thron='[[Thronname]]',
Eigen='[[Eigenname (Pharao)|Eigenname]]',
Turin='[[Königspapyrus Turin|Transliteration aus Turin]]',
Sakkara='[[Königsliste von Sakkara|in Sakkara]]',
Sethos1='[[Königsliste von Abydos (Sethos I.)|in Abydos (Sethos I.)]]',
Ramses2='[[Königsliste von Abydos (Ramses II.)|in Abydos (Ramses II.)]]'
},
en={Horus='[[Horus name]]', Seth='Seth cartouche',
HorusSeth='Horus-Seth cartouche', Nebti='[[Nebty name]]',
Gold='[[Ancient Egyptian royal titulary#Horus of Gold|gold]]',
Thron='[[Prenomen (Ancient Egypt)|Prenomen]]',
Eigen='[[Nomen (ancient Egypt)|Nomen]]',
Turin='[[Turin King List|Transliteration in Turin]]',
Sakkara='[[Saqqara Tablet|in Sakkara]]',
Sethos1='[[Abydos King List|in Abydos (Sethos I.)]]',
Ramses2='in Abydos (Ramses II.)'
}
}
local LangList = list[language] or list.de
return LangList[NameType]
end
local function getData(NameType)
local list = {
Horus={code="G5", bordertype="serech", BorderDefault='none'},
Seth={code="E20", bordertype="serech", BorderDefault='rtd'},
HorusSeth={code="G5-E20", bordertype="serech", BorderDefault='none'},
Nebti={code="G16", bordertype="Cartouche", BorderDefault='none'},
Gold={code="G8", bordertype="Cartouche", BorderDefault='none'},
Thron={code="M23:X1-L2:X1", bordertype="Cartouche", BorderDefault='rtl'},
Eigen={code="G39-N5", bordertype="Cartouche", BorderDefault='rtl'},
Turin={code="", bordertype="Cartouche", BorderDefault='none'},
Sethos1={code="N35!M23-X1:N35", bordertype="Cartouche",
BorderDefault='ltd'},
Ramses2={code="M23-X1-S3", bordertype="Cartouche",
BorderDefault='rtd'},
SakkaraW={code="M23-X1:N35!A44", bordertype="Cartouche",
BorderDefault='rtd'},
SakkaraR={code="M23-X1:N35!A45", bordertype="Cartouche",
BorderDefault='rtd', postfix="Aa11:P8H"}
}
return list[NameType]
end
-- name (single language errors visible for authors)
p.name = function(frame)
if frame.args.kind == nil then return 'Fehler: kein Typ angegeben' end
if frame.args.code == nil then return 'Fehler: kein Inhalt angegeben' end
local kind = frame.args.kind;
local code = frame.args.code
local symbol = frame.args.symbol or 'default'
local border = frame.args.border or 'default'
return Cartouche.name(frame, kind, code, symbol, border)
end
-- name (single language errors visible for authors)
Cartouche.name = function(frame, NameType, code, symbol, border)
local typeData = getData(NameType)
if typeData == nil then return 'Fehler: unbekannter Typ "' .. NameType .. '"' end
if code == nil then return 'Fehler: kein Inhalt angegeben' end
local typeSymbol = ''
if symbol == nil or symbol == 'default' or symbol == '' then
typeSymbol = typeData.code
elseif symbol ~= 'none' then
typeSymbol = symbol
end
local direction = ''
if border == 'nil' or border == '' then direction = typeData.BorderDefault
else direction = border end
if direction == 'none' then -- default: ltr
-- if rtl available replace frame:preprocess with a function for that matter
if typeSymbol == '' then
return frame:preprocess('<hiero>' .. code .. '</hiero>')
else
return frame:preprocess('<hiero>' .. typeSymbol .. '-' .. code .. '</hiero>')
end
end
-- if rtl available replace frame:preprocess with a function for that matter
if symbol == 'none' then
if typeData.bordertype == 'Cartouche' then
if direction == 'ltr' or direction == 'rtl' then
return '{| class="Cartouche"\n| class="lr" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') .. '\n|}'
else
return '{| class="Cartouche"\n| class="td" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') .. '\n|}'
end
else
if direction == 'ltr' or direction == 'rtl' then
return '{| class="Serech"\n| class="core" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') ..
'\n| class="lr" |\n|}'
else
return '{| class="Serech"\n| class="core" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') ..
'\n|-\n| class="td" |\n|}'
end
end
else
if typeData.bordertype == 'Cartouche' then
if direction == 'ltr' or direction == 'rtl' then
return '{| class="Cartouche"\n|' ..
frame:preprocess('<hiero>' .. typeSymbol .. '</hiero>') ..
'\n| class="lr" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') .. '\n|}'
else
return '{| class="Cartouche"\n|' ..
frame:preprocess('<hiero>' .. typeSymbol .. '</hiero>') ..
'\n|-\n| class="td" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') .. '\n|}'
end
else
if direction == 'ltr' or direction == 'rtl' then
return '{| class="Serech"\n|' ..
frame:preprocess('<hiero>' .. typeSymbol .. '</hiero>') ..
'\n| class="core" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') ..
'\n| class="lr" |\n|}'
else
return '{| class="Serech"\n|' ..
frame:preprocess('<hiero>' .. typeSymbol .. '</hiero>') ..
'\n|-\n| class="core" |' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') ..
'\n|-\n| class="td" |\n|}'
end
end
end
end
return p