Modul:Hiero/Saqqara
Zur Navigation springen
Zur Suche springen
Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
Modul | Deutsch | English
|
Modul: | Dokumentation |
Diese Seite enthält Code in der Programmiersprache Lua. Einbindungszahl Cirrus
--[=[ Hiero/Saqqara 2022-01-09
Data Management Module for Access from Within Templates and Other Modules
Author: Vollbracht
* Saqqara.code(row, col) by list
* Saqqara.Lemma(row, col) by list and translations
* Saqqara.note(row, col) by list and noteList
* Saqqara.annotated(row, col) by list, noteList, translations and wikidata
* Saqqara.list
]=]
--Module globals
local p = {service = {}}
-- localized annotation strings
local noteList = {de={
w='<br />%sPharao (Königin)<br />der%s. Dynastie',
m='<br />%sPharao<br />der%s. Dynastie',
illegible='Namenszug nur in Resten erhalten.',
kingList='[[:de:Königsliste von Sakkara|Königsliste<br />von Sakkara]]' ..
'<br />Zeile %d<br />Spalte %d<br />(von rechts)',
link='[[:de:%s|%s]]<br />Zeile %d<br />Spalte %d<br />(von rechts)',
reversePart='Abschnitt mit umgekehrter Reihenfolge.',
reverseIllegible='verderbte Kartusche im Abschnitt mit umgekehrter ' ..
'Reihenfolge'
}
}
--[[
Following data can get obtainedin in query.wikidata.org by
SELECT DISTINCT ?PharaoLabel ?Section ?Row ?Column ?Pharao WHERE {
?Pharao p:P1343 ?statement0.
?statement0 ps:P1343 wd:Q1054563;
pq:P7421 ?Row;
pq:P4775 ?Section;
pq:P3903 ?Column.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?PharaoLabel
as well.
(instead of "en" using any language of choice as far as available in wikidata)
]]
local byLemma = {de={
['Ahmose I.']={2, 1, 2, 'Q7222'},
['Amenemhet I.']={2, 1, 5, 'Q18771'},
['Amenemhet II.']={2, 1, 7, 'Q18734'},
['Amenemhet III.']={2, 1, 10, 'Q19244'},
['Amenemhet IV.']={2, 1, 11, 'Q19246'},
['Amenophis I.']={2, 1, 1, 'Q157966'},
['Anedjib']={2,2,19,'Q111079'},
['Chasechemui']={2,2,9,'Q294266'},
['Cheops']={2, 2, 3, 'Q161904'},
['Chephren']={2, 2, 1, 'Q199861'},
['Djedkare']={2, 1, 18, 'Q269247'},
['Djoser']={2,2,8,'Q174367'},
['Djoserteti']={2,2,7,'Q220256'},
['Hetepsechemui']={2,2,17,'Q151817'},
['Hudjefa I.']={2,2,10,'Q887937'},
['Huni']={2,2,5,'Q220240'},
['Menkauhor']={2, 1, 19, 'Q269257'},
['Mentuhotep II.']={2, 1, 3, 'Q296439'},
['Mentuhotep III.']={2, 1, 4, 'Q310278'},
['Merenre']={2, 1, 14, 'Q269209'},
['Nebkare']={2,2,6,'Q450558'},
['Nebre']={2,2,16,'Q152751'},
['Neferirkare']={1, 2, 3, 'Q268576'},
['Neferkare I.']={2,2,12,'Q349184'},
['Neferkasokar']={2,2,11,'Q464248'},
['Ninetjer']={2,2,15,'Q151824'},
['Nofrusobek']={2, 1, 12, 'Q228951'},
['Pepi I.']={2, 1, 15, 'Q269265'},
['Pepi II.']={2, 1, 13, 'Q6198'},
['Qaa']={2,2,18,'Q151819'},
['Radjedef']={2, 2, 2, 'Q209397'},
['Ramses I.']={1, 1, 3, 'Q1526'},
['Ramses II.']={1, 1, 1, 'Q1523'},
['Raneferef']={1, 2, 1, 'Q269271'},
['Schepseskare']={1, 2, 2, 'Q268601'},
['Sened']={2,2,13,'Q297704'},
['Sesostris I.']={2, 1, 6, 'Q18763'},
['Sesostris II.']={2, 1, 8, 'Q18722'},
['Sesostris III.']={2, 1, 9, 'Q19248'},
['Sethos I.']={1, 1, 2, 'Q157918'},
['Snofru']={2, 2, 4, 'Q189371'},
['Teti II.']={2, 1, 16, 'Q269285'},
['Unas']={2, 1, 17, 'Q244985'},
['Wadjenes']={2,2,14,'Q2538799'}
},
en={
['Ahmose I']={2,1,2,'Q7222'},
['Amenemhat I']={2,1,5,'Q18771'},
['Amenemhat II']={2,1,7,'Q18734'},
['Amenemhat III']={2,1,10,'Q19244'},
['Amenemhat IV']={2,1,11,'Q19246'},
['Amenhotep I']={2,1,1,'Q157966'},
['Anedjib']={2,2,19,'Q111079'},
['Djedefre']={2,2,2,'Q209397'},
['Djedkare Isesi']={2,1,18,'Q269247'},
['Djoser']={2,2,8,'Q174367'},
['Hotepsekhemwy']={2,2,17,'Q151817'},
['Hudjefa I']={2,2,10,'Q887937'},
['Huni']={2,2,5,'Q220240'},
['Khafra']={2,2,1,'Q199861'},
['Khasekhemwy']={2,2,9,'Q294266'},
['Khufu']={2,2,3,'Q161904'},
['Menkauhor Kaiu']={2,1,19,'Q269257'},
['Mentuhotep II']={2,1,3,'Q296439'},
['Mentuhotep III']={2,1,4,'Q310278'},
['Merenre Nemtyemsaf I']={2,1,14,'Q269209'},
['Nebra']={2,2,16,'Q152751'},
['Neferefre']={1,2,1,'Q269271'},
['Neferirkare Kakai']={1,2,3,'Q268576'},
['Neferkara I']={2,2,12,'Q349184'},
['Neferkare']={2,2,6,'Q450558'},
['Neferkasokar']={2,2,11,'Q464248'},
['Nynetjer']={2,2,15,'Q151824'},
['Pepi I Meryre']={2,1,15,'Q269265'},
['Pepi II']={2,1,13,'Q6198'},
["Qa'a"]={2,2,18,'Q151819'},
['Ramesses I']={1,1,3,'Q1526'},
['Ramesses II']={1,1,1,'Q1523'},
['Sekhemkhet']={2,2,7,'Q220256'},
['Senedj']={2,2,13,'Q297704'},
['Senusret I']={2,1,6,'Q18763'},
['Senusret II']={2,1,8,'Q18722'},
['Senusret III']={2,1,9,'Q19248'},
['Seti I']={1,1,2,'Q157918'},
['Shepseskare Isi']={1,2,2,'Q268601'},
['Sneferu']={2,2,4,'Q189371'},
['Sobekneferu']={2,1,12,'Q228951'},
['Teti']={2,1,16,'Q269285'},
['Unas']={2,1,17,'Q244985'},
['Wadjenes']={2,2,14,'Q2538799'}
}}
--[[
Disregarding translation, in query.wikidata.org following data can get obtained by
SELECT DISTINCT ?QNr ?PharaoLabel ?Local (GROUP_CONCAT(?SciTrans; SEPARATOR = " or ") AS ?Scientifical) WHERE {
?Pharao p:P1343 ?statement0.
?statement0 ps:P1343 wd:Q1054563.
OPTIONAL { ?statement0 pq:P2440 ?SciTrans. }
OPTIONAL {
?statement0 pq:P1705 ?Local.
FILTER((LANG(?Local)) = "en")
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
BIND( SUBSTR(xsd:string(?Pharao), 33) AS ?QNr)
}
GROUP BY ?Pharao ?QNr ?PharaoLabel ?Local
ORDER BY xsd:integer(?QNr)
as well (instead of "en" using any language of choice).
]]
local translations = {de={
Q1523={'Ramses II.', '', '', ''},
Q1526={'Ramses I.', '', '', ''},
Q6198={'Pepi II.', 'Nefer-ka-Re', 'Nfr-k3-Rˁ', 'Mit vollkommenem Ka des Re'},
Q7222={'Ahmose I.', 'Neb-peheti-Re', 'Nb-pḥtj-Rˁ',
'Herr der Kraft, ein Re'}, -- Peheti-neb?
Q18722={'Sesostris II.', 'Chai-cheper-Re', 'Ḫˁj-ḫpr-Rˁ',
'Mit erschienener Gestalt, ein Re'},
Q18734={'Amenemhet II.', 'Nebu-ka-Re', 'Nbw-k3-Rˁ',
'Erscheinungsform der Ka-Kraft des Re'},
Q18763={'Sesostris I.', 'Cheper-ka-Re', 'Ḫpr-k3-Rˁ',
'Erscheinungsform der Ka-Kraft des Re'},
Q18771={'Amenemhet I.', 'Sehotep-ib-Re', 'S.htp-jb-Rˁ',
'Zufrieden ist das Herz des Re /<br />Zufrieden ist das Herz ein Re'},
Q19244={'Amenemhet III.', '', '', ''},
Q19246={'Amenemhet IV.', 'Maa-cheru-Re', 'M3ˁ-ḫrw-Rˁ',
'Gerechtfertigter, ein Re'},
Q19248={'Sesostris III.', 'Chai-cheper-Re', 'Ḫˁj-ḫpr-Rˁ',
'Mit erschienener Gestalt, ein Re'},
Q111079={'Anedjib', '', '', ''},
Q151817={'Hetepsechemui', 'Bau-netjer', 'Nṯr-b3.w oder B3w-nṯr', ''},
Q151819={'Qaa', 'Qebehu', 'Qbḥw oder qbḥ.w-ḫntj', ''},
Q151824={'Ninetjer', 'Ba-netjeru', 'B3-nṯr.w', ''},
Q152751={'Nebre', 'Kakau', 'K3-k3w oder K3-k3w', ''},
Q157918={'Sethos I.', '', '', ''},
Q157966={'Amenophis I.', 'Djeser-ka-Re', 'Ḏsr-k3-Rˁ',
'Mit heiligem Ka, ein Re'},
Q161904={'Cheops', 'Chufu', 'Ḫ(w)j=f w(j)', 'Er beschützt mich'},
Q174367={'Djoser', 'Djoser', 'Ḏsr', ''},
Q189371={'Snofru', 'Seneferu', 'S.nfr.w(j)', 'Der mich vollkommen macht'},
Q199861={'Chephren', '', '', ''},
Q209397={'Radjedef', 'Djedef-Re', 'Ḏḏ.f Rˁ', ''},
Q220240={'Huni', 'Huni', 'Hwj oder Hw ni oder Ḥw-nj', ''},
Q220256={'Djoserteti', 'Djoser-teti', 'Ḏsr-ttj', ''},
Q228951={'Nofrusobek', 'Sobek-ka-Re', 'Sbk-k3-Rˁ', 'Ka des Sobek, ein Re'},
Q244985={'Unas', 'Unis / Wenis', 'Wnjs', ''},
Q268576={'Neferirkare', 'Nefer-ir-ka-Re', 'Nfr-jr(.w)-k3-Rˁ', ''},
Q268601={'Schepseskare', 'Schepses-ka-Re', 'Špss-k3-Rˁ',
'Mit edlem Ka, ein Re'},
Q269209={'Merenre', 'Meri-en-Re', 'Mrj-n-Rˁ', 'Der von Re geliebt wird'},
Q269247={'Djedkare', 'Maat-ka-Re', 'M3ˁ.t-k3-Rˁ',
'Die Maat und Ka-Kraft des Re / (mit) Maat und Ka-Kraft, ein Re'},
Q269257={'Menkauhor', 'Men-ka-Hor', 'Mn-k3-Ḥr', 'Mit Ka-Kraft der Horus'},
Q269265={'Pepi I.', 'Pepi', 'Pjpj', 'Pepi'},
Q269271={'Raneferef', 'Chai-nefer-Re', 'Hˁj-nfr-Rˁ',
'Er erscheint vollkommenen, ein Re'},
Q269285={'Teti II.', 'Teti', 'Ttj', ''},
Q296439={'Mentuhotep II.', 'Neb-hapet-Re', 'Nb-ḥ3pt-Rˁ',
'Herr des Ruders des Re'}, -- Hapet-neb?
Q297704={'Sened', 'Sened', 'Snd.j oder Snd', ''},
Q310278={'Mentuhotep III.', 'Seanch-ka-Re', 'Sˁnḫ-k3-Rˁ',
'Der durch das Ka des Re lebt'},
Q349184={'Neferkare I.', 'Nefer-ka-Re', 'Nfr k3 Rˁ', ''},
Q450558={'Nebkare', 'Neb ka Re', 'Nb kꜣ Rˁ', ''},
Q464248={'Neferkasokar', 'Nefer-ka-Sokar', 'Nfr k3 Skr', ''},
Q887937={'Hudjefa I.', '', '', ''},
Q2538799={'Wadjenes', 'Wadjlas', 'W3ḏ l3s', ''}
},
en={
Q1523={'Ramesses II', '', '', ''},
Q1526={'Ramesses I', '', '', ''},
Q6198={'Pepi II', 'Nefer-ka-ra', 'Nfr-k3-Rˁ', ''},
Q7222={'Ahmose I', '', 'Nb-pḥtj-Rˁ', ''},
Q18722={'Senusret II', 'Kha-kheper-ra', 'Ḫˁj-ḫpr-Rˁ or Ḫˁ-ḫpr-Rˁ', ''},
Q18734={'Amenemhat II', 'Nubkare', 'Nbw-k3-Rˁ or nbw k3 (w) rˁ', ''},
Q18763={'Senusret I', 'Kheper-ka-ra', 'Ḫpr-k3-Rˁ', ''},
Q18771={'Amenemhat I', 'Se-hetep-ib-ra', 'S htp ib rˁ', ''},
Q19244={'Amenemhat III', '', '', ''},
Q19246={'Amenemhat IV', 'Maat-kheru-ra', 'M3ˁ-ḫrw-Rˁ', ''},
Q19248={'Senusret III', 'Kha-ka-ra', 'Ḫˁj-k3-Rˁ or ḫˁ k3 (w) rˁ', ''},
Q111079={'Anedjib', '', '', ''},
Q151817={'Hotepsekhemwy', 'Netjerbau', 'Nṯr-b3.w or B3w-nṯr', ''},
Q151819={"Qa'a", 'Qebehu-khenti', 'Qbḥw or qbḥ.w-ḫntj', ''},
Q151824={'Nynetjer', 'Banetjeru', 'B3-nṯr.w', ''},
Q152751={'Nebra', 'Kakau', 'K3-k3w or K3-k3w', ''},
Q157918={'Seti I', '', '', ''},
Q157966={'Amenhotep I', 'Djeserkare', 'Ḏsr-k3-Rˁ', ''},
Q161904={'Khufu', 'Khufu', 'Ḫ(w)j.f w(j) or h f w or Ḫ(w)j=f w(j)', ''},
Q174367={'Djoser', 'Djoser', 'Ḏsr', ''},
Q189371={'Sneferu', 'Snefru', 'snfr-wj or S.nfr.w(j)', ''},
Q199861={'Khafra', '', '', ''},
Q209397={'Djedefre', 'Djedefre', 'Ḏḏ.f Rˁ', 'He endures like Ra'},
Q220240={'Huni', '', 'Hwj or Hw ni or Ḥw-nj', ''},
Q220256={'Sekhemkhet', 'Djoserty', 'Ḏsr-ttj', ''},
Q228951={'Sobekneferu', 'Ka-sobek-re', 'Sbk-k3-Rˁ or kꜣ-sbk-rꜥ', ''},
Q244985={'Unas', 'Unas', 'Wnjs or wnis', ''},
Q268576={'Neferirkare Kakai', 'Neferirkare', 'Nfr-jr(.w)-k3-Rˁ', ''},
Q268601={'Shepseskare Isi', 'Shepses-ka-ra', 'Špss-k3-Rˁ', ''},
Q269209={'Merenre Nemtyemsaf I', 'Mer-en-ra', 'Mrj-n-Rˁ', ''},
Q269247={'Djedkare Isesi', 'Maat-ka-ra', 'M3ˁ.t-k3-Rˁ', ''},
Q269257={'Menkauhor Kaiu', 'Menkahor', 'Mn-k3-Ḥr', ''},
Q269265={'Pepi I Meryre', 'Pepi', 'Pjpj or ppy', ''},
Q269271={'Neferefre', 'Kha-nefer-ra', 'Hˁj-nfr-Rˁ or ḫˁ nfr rˁ', ''},
Q269285={'Teti', 'Teti', 'Ttj or tti', ''},
Q294266={'Khasekhemwy', 'Beb(e)ty', 'Bbtj or Bby', ''},
Q296439={'Mentuhotep II', 'Nebhepetre', 'Nb-ḥ3pt-Rˁ', ''},
Q297704={'Senedj', 'Senedj', 'Snd.j or Snd', ''},
Q310278={'Mentuhotep III', '', 'Sˁnḫ-k3-Rˁ', ''},
Q349184={'Neferkara I', 'Neferkara', 'Nfr k3 Rˁ', ''},
Q450558={'Neferkare', 'Nebkara', 'Nb kꜣ Rˁ', ''},
Q464248={'Neferkasokar', 'Neferkasokar', 'Nfr k3 Skr', ''},
Q887937={'Hudjefa I', '', '', ''},
Q2538799={'Wadjenes', 'Wadjlas', 'W3ḏ l3s', ''}
}}
--[[
trans
formating above list row given by language and Wikidata qualifier
params
language (default is 'de')
id a Wikidata qualifier as listed above
elm [1-4] function will return corresponding list entry
'all' function will format all entries in rows
default function will format entries 2-4 in rows
]]
local function trans(language, id, elm)
local lang = language or 'de'
if type(elm) == number then
if elm < 1 then return '' end
if elm == 3 then return '<i>' .. translations[lang][id][3] .. '</i>' end
if elm < 5 then return translations[lang][id][elm] end
return ''
end
if elm == 'all' then
return '<a href="https://' .. lang .. '.wikipedia.org/wiki/' ..
translations[lang][id][1] .. '">' .. translations[lang][id][1] ..
'</a><br />' .. translations[lang][id][2] .. '<br /><i>' ..
translations[lang][id][3] .. '</i><br />' ..
translations[lang][id][4]
end
if elm == 'lemma' then
return '<a href="https://' .. lang .. '.wikipedia.org/wiki/' ..
translations[lang][id][1] .. '">' .. translations[lang][id][1] ..
'</a>'
end
return translations[lang][id][2] .. '<br /><i>' ..
translations[lang][id][3] .. '</i><br />' ..
translations[lang][id][4]
end
--[[
structure: crown, wikidata, code, No. in dynasty, gender, dynasty, note
list[1]: most right stone
list[2]: rest starting with middle stone; assumed offset of first legible is 10
about code: coding in ltd direction; reading in rtd direction
Not the name but single glyphes are reverted to match direction.
Disregarding crown and note, in query.wikidata.org following data can get
obtained by
SELECT DISTINCT ?Pharao ?Name ?inDyn ?Gender ?Dynastie WHERE {
?Pharao p:P1343 ?statement0.
?statement0 ps:P1343 wd:Q1054563;
pq:P7421 ?Row;
pq:P4775 ?Section;
pq:P3903 ?Column;
pq:P7383 ?Name.
?Pharao p:P21 ?statement1.
?statement1 ps:P21 ?Gnd.
?Pharao p:P31 ?statement2.
?statement2 ps:P31 ?Dyn.
VALUES ?Dyn { wd:Q110670190 wd:Q110644602 wd:Q110643371 wd:Q110559092 wd:Q110556685 wd:Q110552024
wd:Q110884310 wd:Q110550681
wd:Q110551377 wd:Q110576405 }
OPTIONAL{?statement2 pq:P1545 ?inDyn.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".
?Dyn rdfs:label ?Dynastie.
?Gnd rdfs:label ?Gender.
}
}
ORDER BY (?Section) (?Row) (xsd:integer(?Column))
as well.
crown as part of name prefix is coded in a single cypher:
3 prefix contains hieroglyphe A43 (a pharao with white crown of the south)
4 prefix contains hieroglyphe A44 (... with white crown and courge)
5 prefix contains hieroglyphe A45 (... with red crown of the north)
6 prefix contains hieroglyphe A46 (... with red crown and courge)
]]--
p.service.list = {
{ -- right stone = part 1
{ -- top row
{'3', 'Q1523', 'HASH!HASH*HASH!HASH*HASH!N35', '3', 'm', '19',
'illegible'},
{'5', 'Q157918', '', '2', 'm', '19', 'illegible'},
{'3', 'Q1526', 'HASH!HASH!Y5', '1', 'm', '19', 'illegible'}
},
{ -- bottom row
{'5', 'Q269271', 'N5!N28!P8', '', 'm', '5', ''},
{'3', 'Q268601', 'N5!S29\\-S29\\-A51\\!D28', '4', 'm', '5', ''},
{'5', 'Q268576', 'N5!F35!D4!D28', '3', 'm', '5', ''}
}
},
{ -- main part = part 2
{ -- top row
{'3', 'Q157966', 'N5!D45\\!D28', '2', 'm', '18', ''},
{'5', 'Q7222', 'N5!F9\\!V30', '1', 'm', '18', ''},
{'3', 'Q296439', 'N5!P8!V30', '5', 'm', '11', 'reversePart'},
{'5', 'Q310278', 'N5!S34-S29\\!D28', '6', 'm', '11',
'reversePart'},
{'3', 'Q18771', 'N5!R4:Q3*X1-S29\\!X1-F34', '1', 'm', '12',
'reversePart'},
{'5', 'Q18763', 'N5!L1!D28', '2', 'm', '12', 'reversePart'},
{'3', 'Q18734', 'N5!S12!D28', '3', 'm', '12', 'reversePart'},
{'5', 'Q18722', 'N5!N28!L1', '4', 'm', '12', 'reversePart'},
{'3', 'Q19248', 'N5!N28!D28', '5', 'm', '12', 'reversePart'},
{'5', 'Q19244', 'N5!HASH!HASH', '6', 'm', '12', 'reverseIllegible'},
{'3', 'Q19246', 'N5!U5\\!D36\\!G43\\-P8', '7', 'm', '12',
'reversePart'},
{'5', 'Q228951', 'N5!I4\\ !D28', '8', 'm', '12', 'reversePart'},
{'3', 'Q6198', 'N5!F35!D28', '5', 'm', '6', ''},
{'5', 'Q269209', 'N5!U6\\!N35', '4', 'm', '6', ''},
{'3', 'Q269265', 'Q3-Q3!M17\\-M17\\', '3', 'm', '6', ''},
{'5', 'Q269285', 'X1:X1!M17\\', '1', 'm', '6', ''},
{'4', 'Q244985', 'E34!N35!S29\\-M17\\', '9', 'm', '5', ''},
{'6', 'Q269247', 'N5!H6\\!D28', '8', 'm', '5'},
{'4 ', 'Q269257', 'G5\\!Y5!D28', '7', 'm', '5'}
},
{ -- bottom row
{'5', 'Q199861', 'HASH!HASH!HASH!I9\\', '4', 'm', '4',
'illegible'},
{'3', 'Q209397', 'N5!R11-R11!I9\\', '3', 'm', '4', ''},
{'5', 'Q161904', 'N5!I9\\!G43\\!I9\\ ', '2', 'm', '4', ''},
{'3', 'Q189371', 'F35-S29\\!I9\\:D21!G43\\', '1', 'm', '4', ''},
{'5', 'Q220240', 'A25\\-V28!N35:Z4\\!D40\\', '', 'm', '3', ''},
{'3', 'Q450558', 'N5!V30!D28', '', 'm', '3', ''},
{'5', 'Q220256', 'D45\\!X1:X1-M17\\', '3', 'm', '3', ''},
{'3', 'Q174367', 'D45\\!D21', '2', 'm', '3', ''},
{'5', 'Q294266', 'D58\\-D58\\!N21\\!M17\\-M17\\', '', 'm', '2', ''},
{'3', 'Q887937', '', '', '', '2', 'illegible'},
{'5', 'Q464248', 'O34:V31\\:D21!F35!D28', '', 'm', '2', ''},
{'3', 'Q349184', 'N5!F35!D28', '', 'm', '2', ''},
{'5', 'Q297704', 'G54\\', '', 'm', '2', ''},
{'3', 'Q2538799', 'M13!F20\\:Z1!F51\\', '', 'm', '2', ''},
{'5', 'Q151824', 'W10A\\-G29\\!R8\\-X1:D21:G43\\', '3', 'm', '2', ''},
{'3', 'Q152751', 'D28!D52\\:D52\\:D52\\', '2', 'm', '2', ''},
{'6', 'Q151817', 'R8\\!G30\\', '1', 'm', '2', ''},
{'4', 'Q151819', 'X7\\-D58\\-V28!G43\\!W15\\', '8', 'm', '1', ''},
{'5', 'Q111079', 'U7\\!D21!Z1-R7\\!Q3!N35', '6', 'm', '1', ''}
}}}
-- We assume the first legible column in main part of the list being the 11th
-- column of what orriginally has been written.
local mainPartColOffset = 7
local maxCol = 22 -- virtually 29
local maxFirst = 3
-- iterators for this table --
--[[
RowColTriples iterator
iterates through all elements of p.service.list
returns
row
virtual column
the element itself
usage: for row, col, v in p.service.list.RowColTriples() do
]]
p.service.list.RowColTriples = function()
local row = function(i)
if i > maxCol then return 2 end
return 1
end
local col = function(i)
local result = i
if i > maxCol then
result = i - maxCol
end
if result > maxFirst then
return result - maxFirst
else
return result
end
end
local part = function(i) -- 1 or 2
if i > maxCol then
if i - maxCol > maxFirst then
return 2
end
return 1
end
if i > maxFirst then
return 2
end
return 1
end
local virtualCol = function(col)
if col > maxFirst then return col + mainPartColOffset end
return col
end
local i = 0
local RowColTriples_iterator = function()
i = i + 1
return row(i), virtualCol(col(i)),
p.service.list[part(i)][row(i)][col(i)]
end
end
--[[
ColTriples iterator
iterates through all columns in all parts of p.service.list
returns
virtual column
the element in first row
the element in second row
usage: for col, v1, v2 in p.service.list.ColTriples() do
]]
p.service.list.ColTriples = function()
local col = 0
local RowColTriples_iterator = function()
col = col + 1
if col > maxFirst then
return col + mainPartColOffset,
p.service.list[2][1][col - maxFirst],
p.service.list[2][2][col - maxFirst]
else
return col,
p.service.list[2][1][col],
p.service.list[2][2][col]
end
end
end
--[[
PartRowColQuadruples iterator
iterates through all elements of p.service.list
returns
part
row
column
the element itself
usage: for part, row, col, v in p.service.list.RowColTriples() do
]]
p.service.list.RowColQuadruples = function()
local i = 0
local RowColQuadruples_iterator = function()
i = i + 1
if i < maxCol then
if i > maxFirst then
local col = i - maxFirst
return 2, 1, col, p.service.list[2][1][col]
else
return 1, 1, i, p.service.list[1][1][i]
end
else
local col = i - maxCol
if col > maxFirst then
col = col - maxFirst
return 2, 2, col, p.service.list[2][2][col]
else
return 1, 2, col, p.service.list[1][2][i]
end
end
end
end
--[[
PartColTriples iterator
iterates through all columns in given part of p.service.list
returns
column
the element in first row
the element in second row
usage: for col, v1, v2 in p.service.list[part].ColTriples(part) do
]]
p.service.list.PartColTriples = function(part)
local col = 0
local PartColTriples_iterator = function()
col = col + 1
return col,
p.service.list[part][1][col],
p.service.list[part][2][col]
end
end
-- access data by row and virtual column --
--[[
code
(other modules only)
correspondig to p.service.list[part][row][col][3]
]]
p.service.code = function(row, col)
if row < 0 or col < 0 or row > 2 or col - mainPartColOffset > maxCol then
return ''
end
if col <= maxFirst then
return this.list[1][row][col][3]
end
local realCol = col - maxFirst - mainPartColOffset
if realCol < 1 then return '' end
return p.service.list[2][row][realCol][3]
end
-- access data by lemma --
--[[
row2c
row with 2 columns describing a pharao selected by lemma
params
language (default: 'de') shortening for Wikipedia ('de' for deWiki)
lemma name of a pharao as in given Wikipedia
frame providing preprocess method (ignore in template)
returns html table row
]]
p.service.row2c = function(frame, language, lemma)
local lang = language or 'de'
local data = byLemma[lang][lemma]
if type(data) ~= 'table' then return '' end
local vcol = (data[1] - 1) * (mainPartColOffset + maxFirst) + data[3]
local sl = p.service.list[data[1]][data[2]][data[3]]
local top = frame:preprocess('<hiero>X1:N35-M23\\!A4' .. sl[1] ..
'\\</hiero>')
local dynOrder = sl[4] -- e.g. '3' for '3. Pharao'
if dynOrder ~= '' then dynOrder = dynOrder .. '. ' end
-- '3', 'm', '5' => '3. Pharao of 5. dynasty'
local infos = string.format(noteList[lang][sl[5]], dynOrder, sl[6])
return '<td class="hiero"><table class="Cartouche"><tr><td>' ..
top .. '</td></tr><tr><td class="td">' ..
frame:preprocess('<hiero>' .. sl[3] .. '</hiero>') ..
'</td></tr><tr><td>' ..
frame:preprocess('<hiero>Aa11\\:P8H\</hiero>') ..
'</td></tr></table></td><td>' ..
string.format(noteList[lang].link, lemma, lemma, data[2], vcol) ..
infos ..
'<br />' .. trans(lang, data[4], '') .. '</td></tr><tr>'
end
p.row2c = function(frame)
return p.service.row2c(frame, frame.args.language, frame.args.lemma)
end
-- return row selected by lemma
p.service.row3c = function(frame, language, lemma)
local lang = language or 'de'
local data = byLemma[lang][lemma]
if type(data) ~= 'table' then return '' end
local vcol = (data[1] - 1)*mainPartColOffset+data[3]
local top
if (data[2]+vcol) % 2 == 0 then -- use white crown in A43
top = frame:preprocess('<hiero>X1:N35-M23\\!A43\\</hiero>')
else -- use red crown in A45
top = frame:preprocess('<hiero>X1:N35-M23\\!A45\\</hiero>')
end
local code = p.service.list[data[1]][data[2]][data[3]][3]
return '<td>' .. string.format(noteList.de.kingList, data[2], vcol) ..
'</td><td class="hiero"><table class="Cartouche"><tr><td>' ..
top .. '</td></tr><tr><td class="td">' ..
frame:preprocess('<hiero>' .. code .. '</hiero>') ..
'</td></tr><tr><td>' ..
frame:preprocess('<hiero>Aa11\\:P8H\</hiero>') ..
'</td></tr></table></td><td>' ..
trans(lang, data[4], '') .. '</td></tr><tr>'
end
p.row3c = function(frame)
return p.service.row3c(frame, frame.args.language, frame.args.lemma)
end
-- return single lemma selected by row, col and lang (wiki)
p.service.Lemma = function(row, col, language)
if row < 0 or col < 0 or row > 2 or col > 29 then return '' end
local id
if col < 4 then id = this.list[1][row][col][2]
elseif col <= mainPartColOffset then return ''
else id = p.service.list[2][row][col-mainPartColOffset][2]
end
return trans(language, id, 'lemma')
end
p.Lemma = function(frame)
if frame.args.row == nil or frame.args.col == nil then
return ''
end
local r = string.gsub(frame.args.row, '^%s*(.-)%s*$', '%1')
local c = string.gsub(frame.args.col, '^%s*(.-)%s*$', '%1')
local row = tonumber(r)
local col = tonumber(c)
return p.service.Lemma(row, col, frame.args.lang)
end
-- return single name in hieroglyphs selected by row and column
p.service.name = function(frame, row, col)
if row < 0 or col < 0 or row > 2 or col > 29 then return '' end
local code = p.service.code(row, col)
if type(code) ~= 'string' then return '' end
local top
if (row+col) % 2 == 0 then -- use white crown in A43
top = frame:preprocess('<hiero>X1:N35-M23\\!A43\\</hiero>')
else -- use red crown in A45
top = frame:preprocess('<hiero>X1:N35-M23\\!A45\\</hiero>')
end
local core = frame:preprocess('<hiero>' .. code .. '</hiero>')
local bottom = frame:preprocess('<hiero>Aa11\\:P8H\\</hiero>')
return '<table class="Cartouche"><tr><td>' .. top ..
'</td></tr><tr><td class="td">' .. core ..
'</td></tr><tr><td>' .. bottom .. '</td></tr></table>'
end
p.name = function(frame)
if frame.args.row == nil or frame.args.col == nil then
return ''
end
local r = string.gsub(frame.args.row, '^%s*(.-)%s*$', '%1')
local c = string.gsub(frame.args.col, '^%s*(.-)%s*$', '%1')
local row = tonumber(r)
local col = tonumber(c)
return p.service.name(frame, row, col)
end
return p