Dokumentation för denna modul finns på /dok (redigera), /test
Implementerar {{härledning}}
.
local export = {}
local lang = require("Modul:lang")
local lk = require("Modul:link")
local catsort = require("Modul:sort")
function export.getWikitext(frame)
local args = frame:getParent().args
if (not args) or (not args) or (not args) then
return "]"
end
if (args=='') or (args=='') or (args=='') or (args=='') then -- missing legal, empty string NOT legal
return "]"
end
if args or args or args or args then -- use "Modul:param"
return "]]"
end
if (lang.isObviouslyInvalid(args) or lang.isObviouslyInvalid(args) and args ~= "xx") then
return "]]"
end
if ((not lang.hasLanguage(args)) or not (lang.hasLanguage(args, "alsoetym")) and args ~= "xx") then
return "]]"
end
local opening = ""
local period ="."
local ucfirst_entry_language_name = lang.getLanguageUCFirst(args)
local lc_origin_lang_name = lang.getLanguage(args, "alsoetym")
local origin_lang_word = args or lc_origin_lang_name
if args == "grc" then
origin_lang_word = "grekiska"
elseif args == "gd" then
origin_lang_word = "gäliska"
elseif args == "el" then
origin_lang_word = "nygrekiska"
elseif args == "la" then
origin_lang_word = "latinska"
end
local include_origin_lang_word = true
if args then
if args == "-" then
include_origin_lang_word = false
elseif args ~= "" then
origin_lang_word = args
end
end
local ucfirst_language = lang.getLanguageUCFirst(args, "alsoetym")
local lc = args -- obligatory
local derivative = args -- obligatory (special value "-" if none)
local literal_meaning = args -- optional
local translitteration = args -- optional
local tr_and_lit_text = ''
if translitteration then
tr_and_lit_text = "<i>" .. translitteration .. "</i>"
end
if (literal_meaning and translitteration) then
tr_and_lit_text = tr_and_lit_text .. ', '
end
if literal_meaning then
if (literal_meaning=='-') then -- special value "-" for same meaning, do NOT write "sammma betydelse" literally
tr_and_lit_text = tr_and_lit_text .. 'med samma betydelse'
else
tr_and_lit_text = tr_and_lit_text .. '”' .. literal_meaning .. '”'
end
end
if (literal_meaning or translitteration) then
tr_and_lit_text = '(' .. tr_and_lit_text .. ')'
end
local italics = (args ~= "-")
local derivative_text = ""
if (derivative and (derivative~="-")) then
derivative_text = lk.link(derivative, lc)
if (italics) then
derivative_text = '<i>' .. derivative_text .. '</i>'
end
end
local str = ''
local sort_key = ''
local lemma_pagename = ''
if include_origin_lang_word then
str = str .. origin_lang_word
end
if (derivative_text~='') then
if str ~= "" then
str = str.. " "
end
str = str .. derivative_text
end
if (tr_and_lit_text~='') then
if str ~= "" then
str = str.. " "
end
str = str .. tr_and_lit_text
end
local derivative_no_nil = derivative or ""
if args ~= "-" then
lemma_pagename = args or mw.title.getCurrentTitle().text
sort_key = catsort.getSortKey (args, lemma_pagename)
if args ~= "xx" then
if (sort_key==lemma_pagename) then
str = str .. "]"
else
str = str .. "]"
end
else
str = str .. "]]"
end
if args then
str = str .. "]"
end
if args then
str = str .. "]"
end
if args and (string.sub(args,-13,-1) == "mma betydelse") then
str = str .. "]"
end
end
return str
end
return export