„Modul:Wortbedeutungen“ – Versionsunterschied
Erscheinungsbild
K wieder Reparatur Markierung: Zurückgesetzt |
KKeine Bearbeitungszusammenfassung Markierung: Manuelle Zurücksetzung |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | |||
local | function p.zeig(frame) | ||
local modi = frame.args[1] or "" | |||
local num = frame.args[2] or "" | |||
local title = mw.title.getCurrentTitle() | |||
local content = title:getContent() or "" | |||
local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)") | |||
if not sprachvorstufe then | |||
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]") | |||
local | |||
if not | |||
end | end | ||
if not sprachvorstufe or sprachvorstufe == "" then | |||
return "[" .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | |||
end | |||
local other = mw.title.new(sprachvorstufe) | |||
local | if not other then | ||
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | end | ||
local otherContent = other:getContent() or "" | |||
local sprachstufe = otherContent:match("%[%[Sprachstufe::([^%]]+)%]%]") | |||
local | local lastLang = sprachstufe and sprachstufe:match("([a-z]+%.)%s*$") or sprachstufe or "[Sprachstufe nicht gefunden]" | ||
local | |||
local | local output = {} | ||
local | |||
if | if modi:find("N") then | ||
table.insert(output, lastLang .. " [[" .. sprachvorstufe .. "]]") | |||
end | |||
local | if modi:find("B") then | ||
local bedeutungen = {} | |||
for bedeutung in otherContent:gmatch("%[%[Wortbedeutung::([^%]]+)%]%]") do | |||
table.insert(bedeutungen, bedeutung) | |||
end | |||
if #bedeutungen > 0 then | |||
table.insert(output, "'" .. table.concat(bedeutungen, ", ") .. "'") | |||
end | |||
end | |||
if modi:find("D") then | |||
local dingbedeutungen = {} | |||
for bedeutung in otherContent:gmatch("%[%[Dingbedeutung::([^%]]+)%]%]") do | |||
table.insert(dingbedeutungen, bedeutung) | |||
end | |||
if #dingbedeutungen > 0 then | |||
table.insert(output, "'" .. table.concat(dingbedeutungen, ", ") .. "'") | |||
end | |||
end | |||
return table.concat(output, " ") | |||
end | end | ||
function p.zeigN(frame) | |||
function p. | local num = frame.args[1] or "" | ||
local | |||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local content = title:getContent() or "" | local content = title:getContent() or "" | ||
local | local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)") | ||
if not | if not sprachvorstufe then | ||
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]") | |||
end | |||
local | if not sprachvorstufe or sprachvorstufe == "" then | ||
local | return "[" .. num .. "-Sprachvorstufe nicht gefunden]" | ||
return | end | ||
local other = mw.title.new(sprachvorstufe) | |||
if not other then | |||
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | |||
local otherContent = other:getContent() or "" | |||
local sprachstufe = otherContent:match("%[%[Sprachstufe::([^%]]+)%]%]") | |||
if sprachstufe and sprachstufe ~= "" then | |||
local lastLang = sprachstufe:match("([a-z]+%.)%s*$") or sprachstufe | |||
return lastLang .. " [[" .. sprachvorstufe .. "]]" | |||
else | |||
return "[Sprachstufe nicht gefunden in " .. sprachvorstufe .. "]" | |||
end | |||
end | end | ||
function p.zeigB(frame) | function p.zeigB(frame) | ||
local | local num = frame.args[1] or "" | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local content = title:getContent() or "" | local content = title:getContent() or "" | ||
local | local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)") | ||
if not | if not sprachvorstufe then | ||
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]") | |||
end | |||
if not sprachvorstufe or sprachvorstufe == "" then | |||
return "[" .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | |||
local other = mw.title.new(sprachvorstufe) | |||
if not other then | |||
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | |||
local otherContent = other:getContent() or "" | |||
local bedeutungen = {} | |||
for bedeutung in otherContent:gmatch("%[%[Wortbedeutung::([^%]]+)%]%]") do | |||
table.insert(bedeutungen, bedeutung) | |||
end | |||
if #bedeutungen == 0 then | |||
return "[Keine Wortbedeutung gefunden in " .. sprachvorstufe .. "]" | |||
return | |||
else | else | ||
return | return table.concat(bedeutungen, ", ") | ||
end | end | ||
end | end | ||
function p.zeigD(frame) | function p.zeigD(frame) | ||
local | local num = frame.args[1] or "" | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local content = title:getContent() or "" | local content = title:getContent() or "" | ||
local | local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)") | ||
if not | if not sprachvorstufe then | ||
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]") | |||
end | |||
if not sprachvorstufe or sprachvorstufe == "" then | |||
return "[" .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | |||
local other = mw.title.new(sprachvorstufe) | |||
if not other then | |||
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]" | |||
end | |||
local otherContent = other:getContent() or "" | |||
local dingbedeutungen = {} | |||
for bedeutung in otherContent:gmatch("%[%[Dingbedeutung::([^%]]+)%]%]") do | |||
table.insert(dingbedeutungen, bedeutung) | |||
end | |||
if #dingbedeutungen == 0 then | |||
return "[Keine Dingbedeutung gefunden in " .. sprachvorstufe .. "]" | |||
return | |||
else | else | ||
return | return table.concat(dingbedeutungen, ", ") | ||
end | end | ||
end | end | ||
return p | return p | ||
Aktuelle Version vom 17. April 2025, 13:40 Uhr
Die Dokumentation für dieses Modul kann unter Modul:Wortbedeutungen/Doku erstellt werden
local p = {}
function p.zeig(frame)
local modi = frame.args[1] or ""
local num = frame.args[2] or ""
local title = mw.title.getCurrentTitle()
local content = title:getContent() or ""
local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)")
if not sprachvorstufe then
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]")
end
if not sprachvorstufe or sprachvorstufe == "" then
return "[" .. num .. "-Sprachvorstufe nicht gefunden]"
end
local other = mw.title.new(sprachvorstufe)
if not other then
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]"
end
local otherContent = other:getContent() or ""
local sprachstufe = otherContent:match("%[%[Sprachstufe::([^%]]+)%]%]")
local lastLang = sprachstufe and sprachstufe:match("([a-z]+%.)%s*$") or sprachstufe or "[Sprachstufe nicht gefunden]"
local output = {}
if modi:find("N") then
table.insert(output, lastLang .. " [[" .. sprachvorstufe .. "]]")
end
if modi:find("B") then
local bedeutungen = {}
for bedeutung in otherContent:gmatch("%[%[Wortbedeutung::([^%]]+)%]%]") do
table.insert(bedeutungen, bedeutung)
end
if #bedeutungen > 0 then
table.insert(output, "'" .. table.concat(bedeutungen, ", ") .. "'")
end
end
if modi:find("D") then
local dingbedeutungen = {}
for bedeutung in otherContent:gmatch("%[%[Dingbedeutung::([^%]]+)%]%]") do
table.insert(dingbedeutungen, bedeutung)
end
if #dingbedeutungen > 0 then
table.insert(output, "'" .. table.concat(dingbedeutungen, ", ") .. "'")
end
end
return table.concat(output, " ")
end
function p.zeigN(frame)
local num = frame.args[1] or ""
local title = mw.title.getCurrentTitle()
local content = title:getContent() or ""
local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)")
if not sprachvorstufe then
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]")
end
if not sprachvorstufe or sprachvorstufe == "" then
return "[" .. num .. "-Sprachvorstufe nicht gefunden]"
end
local other = mw.title.new(sprachvorstufe)
if not other then
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]"
end
local otherContent = other:getContent() or ""
local sprachstufe = otherContent:match("%[%[Sprachstufe::([^%]]+)%]%]")
if sprachstufe and sprachstufe ~= "" then
local lastLang = sprachstufe:match("([a-z]+%.)%s*$") or sprachstufe
return lastLang .. " [[" .. sprachvorstufe .. "]]"
else
return "[Sprachstufe nicht gefunden in " .. sprachvorstufe .. "]"
end
end
function p.zeigB(frame)
local num = frame.args[1] or ""
local title = mw.title.getCurrentTitle()
local content = title:getContent() or ""
local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)")
if not sprachvorstufe then
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]")
end
if not sprachvorstufe or sprachvorstufe == "" then
return "[" .. num .. "-Sprachvorstufe nicht gefunden]"
end
local other = mw.title.new(sprachvorstufe)
if not other then
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]"
end
local otherContent = other:getContent() or ""
local bedeutungen = {}
for bedeutung in otherContent:gmatch("%[%[Wortbedeutung::([^%]]+)%]%]") do
table.insert(bedeutungen, bedeutung)
end
if #bedeutungen == 0 then
return "[Keine Wortbedeutung gefunden in " .. sprachvorstufe .. "]"
else
return table.concat(bedeutungen, ", ")
end
end
function p.zeigD(frame)
local num = frame.args[1] or ""
local title = mw.title.getCurrentTitle()
local content = title:getContent() or ""
local sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^|%]]+)")
if not sprachvorstufe then
sprachvorstufe = content:match("%[%[" .. num .. "%-Sprachvorstufe::([^%]]+)%]%]")
end
if not sprachvorstufe or sprachvorstufe == "" then
return "[" .. num .. "-Sprachvorstufe nicht gefunden]"
end
local other = mw.title.new(sprachvorstufe)
if not other then
return "[Seite der " .. num .. "-Sprachvorstufe nicht gefunden]"
end
local otherContent = other:getContent() or ""
local dingbedeutungen = {}
for bedeutung in otherContent:gmatch("%[%[Dingbedeutung::([^%]]+)%]%]") do
table.insert(dingbedeutungen, bedeutung)
end
if #dingbedeutungen == 0 then
return "[Keine Dingbedeutung gefunden in " .. sprachvorstufe .. "]"
else
return table.concat(dingbedeutungen, ", ")
end
end
return p