2,788
edits
No edit summary Tag: Manual revert |
No edit summary |
||
Line 6: | Line 6: | ||
linked = {type = "boolean"}, | linked = {type = "boolean"}, | ||
nopre = {type = "boolean"}, | nopre = {type = "boolean"}, | ||
} | |||
local params_inline = { | |||
[1] = {}, | |||
[2] = {list = true}, | |||
} | } | ||
function | function format_ipa(language, ipa, nolarge, nopre, linked) | ||
local language_pron = "Appendix:" .. language.name .. "_pronunciation" | local language_pron = "Appendix:" .. language.name .. "_pronunciation" | ||
out = "" | local out = "" | ||
if not | if not nopre then | ||
out = out .. "[[w:International_Phonetic_Alphabet|IPA]]" | out = out .. "[[w:International_Phonetic_Alphabet|IPA]]" | ||
out = out .. "<sup>([[" .. language_pron .. "|key]])</sup>: " | out = out .. "<sup>([[" .. language_pron .. "|key]])</sup>: " | ||
end | end | ||
local class = "IPA" | local class = "IPA" | ||
if | if nolarge then class = class .. " nolarge" end | ||
for i, i_ipa in ipairs( | for i, i_ipa in ipairs(ipa) do | ||
if i > 1 then out = out .. ", " end | if i > 1 then out = out .. ", " end | ||
out = out .. '<span class="' .. class .. '">' | out = out .. '<span class="' .. class .. '">' | ||
if | if linked then | ||
out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]" | out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]" | ||
else | else | ||
Line 33: | Line 32: | ||
end | end | ||
return out | return out | ||
end | |||
function export.show(frame) | |||
local args = require("Module:parameters").process(frame:getParent().args, params) | |||
local language = require("Module:languages").get_by_code(args[1]) | |||
if language == nil then | |||
error("No such language: " .. args[1]) | |||
end | |||
return format_ipa(args[1], args[2], args["nolarge"], args["nopre"], args["linked"]) | |||
end | |||
function export.show_inline(frame) | |||
local args = require("Module:parameters").process(frame:getParent().args, params_inline) | |||
local language = require("Module:languages").get_by_code(args[1]) | |||
if language == nil then | |||
error("No such language: " .. args[1]) | |||
end | |||
return format_ipa(args[1], args[2], true, true, true) | |||
end | end | ||
return export | return export |