„Modul:CactaceaeTaxonok” változatai közötti eltérés
Megjelenés
Nincs szerkesztési összefoglaló Címke: Kézi visszaállítás |
Nincs szerkesztési összefoglaló Címke: Visszaállítva |
||
| 1. sor: | 1. sor: | ||
local p = {} | local p = {} | ||
-- | -- Unicode-biztos formázó a szinonimákhoz | ||
local function formazSzinonimak(szoveg) | local function formazSzinonimak(szoveg) | ||
if not szoveg or szoveg == "" then return "" end | if not szoveg or szoveg == "" then return "" end | ||
local tiszta = mw.ustring.gsub(szoveg, "[đ÷]", "") | local tiszta = mw.ustring.gsub(szoveg, "[đ÷]", "") | ||
tiszta = mw.ustring.gsub(tiszta, "¤+", "") | tiszta = mw.ustring.gsub(tiszta, "¤+", "") | ||
-- | -- Jelölők egyszerűsítése | ||
tiszta = mw.ustring.gsub(tiszta, ">−", "−") | tiszta = mw.ustring.gsub(tiszta, ">−", "−") | ||
tiszta = mw.ustring.gsub(tiszta, ">≡", "≡") | tiszta = mw.ustring.gsub(tiszta, ">≡", "≡") | ||
tiszta = mw.ustring.gsub(tiszta, ">=", "=") | tiszta = mw.ustring.gsub(tiszta, ">=", "=") | ||
-- | -- Dupla jeleknél darabolunk új listapontba | ||
tiszta = mw.ustring.gsub(tiszta, "≡≡", "|≡") | tiszta = mw.ustring.gsub(tiszta, "≡≡", "|≡") | ||
tiszta = mw.ustring.gsub(tiszta, "==", "|=") | tiszta = mw.ustring.gsub(tiszta, "==", "|=") | ||
tiszta = mw.ustring.gsub(tiszta, "−−", "|−") | tiszta = mw.ustring.gsub(tiszta, "−−", "|−") | ||
tiszta = mw.ustring.gsub(tiszta, "%%-%%-", "|−") | |||
tiszta = mw.ustring.gsub(tiszta, "%-%-", "|−") | |||
local lista_elemek = {} | local lista_elemek = {} | ||
for resz in mw.text.gsplit(tiszta, "|", true) do | for resz in mw.text.gsplit(tiszta, "|", true) do | ||
local tiszta_resz = mw.text.trim(resz) | local tiszta_resz = mw.text.trim(resz) | ||
if tiszta_resz ~= "" then | if tiszta_resz ~= "" then | ||
local szavak = {} | local szavak = {} | ||
for szo in mw.ustring.gmatch(tiszta_resz, "%S+") do | for szo in mw.ustring.gmatch(tiszta_resz, "%S+") do | ||
if mw.ustring.find(szo, "[≡=−,]") or szo == "var." or szo == "subsp." or szo == "f." or szo == "Type:" then | if mw.ustring.find(szo, "[≡=−,]") or szo == "var." or szo == "subsp." or szo == "f." or szo == "Type:" then | ||
table.insert(szavak, szo) | table.insert(szavak, szo) | ||
| 39. sor: | 31. sor: | ||
end | end | ||
end | end | ||
table.insert(lista_elemek, "<li>" .. table.concat(szavak, " ") .. "</li>") | |||
table.insert(lista_elemek, "<li>" .. | |||
end | end | ||
end | end | ||
if #lista_elemek > 0 then | if #lista_elemek > 0 then | ||
return '<ul style="margin-left: 1.1em; list-style-type: disc; padding: 0; margin | return '<ul style="margin-left: 1.1em; list-style-type: disc; padding: 0; margin: 0;">' .. table.concat(lista_elemek) .. "</ul>" | ||
end | end | ||
return "" | |||
end | end | ||
| 64. sor: | 51. sor: | ||
local sorszam = 0 | local sorszam = 0 | ||
for sor in mw.ustring.gmatch(nyers_adat, "[^\r\n]+") do | for sor in mw.ustring.gmatch(nyers_adat, "[^\r\n]+") do | ||
local | local taxon_nyers, szinonimak = "", "" | ||
local | local tipus = "" | ||
if mw.ustring.match(sor, "^ß") then | if mw.ustring.match(sor, "^ß") then | ||
local nemzettseg, | -- Nemzetség (ß) | ||
local nemzettseg, szo = mw.ustring.match(sor, "^ß%s*([^:]+)::%s*(.+)") | |||
if nemzettseg then | if nemzettseg then | ||
taxon_nyers = mw.text.trim(nemzettseg):gsub("¤+", "") | |||
szinonimak = tipus | szinonimak = szo | ||
tipus = "nemzettseg" | |||
end | end | ||
elseif mw.ustring.match(sor, "^Ł") then | elseif mw.ustring.match(sor, "^Ł") then | ||
-- Faj vagy egyéb (Ł) | |||
local tiszta_sor = mw.ustring.gsub(sor, "^Ł%s*", "") | local tiszta_sor = mw.ustring.gsub(sor, "^Ł%s*", "") | ||
local t, sz = mw.ustring.match(tiszta_sor, "([^¤]+)¤¤¤(.*)") | local t, sz = mw.ustring.match(tiszta_sor, "([^¤]+)¤¤¤(.*)") | ||
if t then | if t then | ||
taxon_nyers = mw.text.trim(t) | |||
szinonimak = sz | szinonimak = sz | ||
tipus = "faj" | |||
end | end | ||
end | end | ||
if | if taxon_nyers ~= "" then | ||
sorszam = sorszam + 1 | sorszam = sorszam + 1 | ||
local taxon_link = "" | |||
if tipus == "nemzettseg" then | |||
-- Nemzetség: Kategória link + Vastagítás | |||
taxon_link = "[[:Kategória:" .. taxon_nyers .. "|" .. taxon_nyers .. "]]" | |||
taxon_link = "'''" .. taxon_link .. "'''" | |||
else | |||
-- Faj: Sima belső link + Dőltetés | |||
taxon_link = "[[" .. taxon_nyers .. "]]" | |||
taxon_link = "''" .. taxon_link .. "''" | |||
end | |||
res = res .. "|-\n" | res = res .. "|-\n" | ||
res = res .. "| " .. sorszam .. "\n" | res = res .. "| " .. sorszam .. "\n" | ||
res = res .. '| style="white-space: nowrap;" | ' .. | res = res .. '| style="white-space: nowrap;" | ' .. taxon_link .. "\n" | ||
res = res .. "| " .. formazSzinonimak(szinonimak) .. "\n" | res = res .. "| " .. formazSzinonimak(szinonimak) .. "\n" | ||
end | end | ||
A lap 2026. január 7., 08:16-kori változata
A modult a Modul:CactaceaeTaxonok/doc lapon tudod dokumentálni
local p = {}
-- Unicode-biztos formázó a szinonimákhoz
local function formazSzinonimak(szoveg)
if not szoveg or szoveg == "" then return "" end
local tiszta = mw.ustring.gsub(szoveg, "[đ÷]", "")
tiszta = mw.ustring.gsub(tiszta, "¤+", "")
-- Jelölők egyszerűsítése
tiszta = mw.ustring.gsub(tiszta, ">−", "−")
tiszta = mw.ustring.gsub(tiszta, ">≡", "≡")
tiszta = mw.ustring.gsub(tiszta, ">=", "=")
-- Dupla jeleknél darabolunk új listapontba
tiszta = mw.ustring.gsub(tiszta, "≡≡", "|≡")
tiszta = mw.ustring.gsub(tiszta, "==", "|=")
tiszta = mw.ustring.gsub(tiszta, "−−", "|−")
tiszta = mw.ustring.gsub(tiszta, "%%-%%-", "|−")
local lista_elemek = {}
for resz in mw.text.gsplit(tiszta, "|", true) do
local tiszta_resz = mw.text.trim(resz)
if tiszta_resz ~= "" then
local szavak = {}
for szo in mw.ustring.gmatch(tiszta_resz, "%S+") do
if mw.ustring.find(szo, "[≡=−,]") or szo == "var." or szo == "subsp." or szo == "f." or szo == "Type:" then
table.insert(szavak, szo)
else
table.insert(szavak, "''" .. szo .. "''")
end
end
table.insert(lista_elemek, "<li>" .. table.concat(szavak, " ") .. "</li>")
end
end
if #lista_elemek > 0 then
return '<ul style="margin-left: 1.1em; list-style-type: disc; padding: 0; margin: 0;">' .. table.concat(lista_elemek) .. "</ul>"
end
return ""
end
function p.tablazat(frame)
local status, adatModul = pcall(require, 'Modul:CactaceaeTaxonokData')
if not status then return "Hiba: A 'Modul:CactaceaeTaxonokData' nem található!" end
local nyers_adat = adatModul.getAdatok()
local res = '{| class="wikitable sortable datatable-hook stripe hover compact" data-page-length="50" style="width:100%; font-size:90%;"\n'
res = res .. "! # !! Taxonnév !! Típusfaj, szinonima\n"
local sorszam = 0
for sor in mw.ustring.gmatch(nyers_adat, "[^\r\n]+") do
local taxon_nyers, szinonimak = "", ""
local tipus = ""
if mw.ustring.match(sor, "^ß") then
-- Nemzetség (ß)
local nemzettseg, szo = mw.ustring.match(sor, "^ß%s*([^:]+)::%s*(.+)")
if nemzettseg then
taxon_nyers = mw.text.trim(nemzettseg):gsub("¤+", "")
szinonimak = szo
tipus = "nemzettseg"
end
elseif mw.ustring.match(sor, "^Ł") then
-- Faj vagy egyéb (Ł)
local tiszta_sor = mw.ustring.gsub(sor, "^Ł%s*", "")
local t, sz = mw.ustring.match(tiszta_sor, "([^¤]+)¤¤¤(.*)")
if t then
taxon_nyers = mw.text.trim(t)
szinonimak = sz
tipus = "faj"
end
end
if taxon_nyers ~= "" then
sorszam = sorszam + 1
local taxon_link = ""
if tipus == "nemzettseg" then
-- Nemzetség: Kategória link + Vastagítás
taxon_link = "[[:Kategória:" .. taxon_nyers .. "|" .. taxon_nyers .. "]]"
taxon_link = "'''" .. taxon_link .. "'''"
else
-- Faj: Sima belső link + Dőltetés
taxon_link = "[[" .. taxon_nyers .. "]]"
taxon_link = "''" .. taxon_link .. "''"
end
res = res .. "|-\n"
res = res .. "| " .. sorszam .. "\n"
res = res .. '| style="white-space: nowrap;" | ' .. taxon_link .. "\n"
res = res .. "| " .. formazSzinonimak(szinonimak) .. "\n"
end
end
res = res .. "|}"
return frame:preprocess(res)
end
return p