词条 | Module:IPA symbol/sandbox/future |
释义 | local p, __output, args, data = {}, {}, {}, mw.loadData("Module:IPA symbol/sandbox/data") local id, output __output.input = function() return args[1] end __output.name = function() return data.correspondences[id]["name"] end __output.wikipage = function() return data.correspondences[id]["wikipage"] end __output.soundfile = function() return data.correspondences[id]["soundfile"] end __output.type = function() return data.correspondences[id]["type"] end local function __link() end local function __ipa() if args.ipa_brackets then if args.ipa_brackets == "[" or args.ipa_brackets == "]" then return mw.ustring.format("%s[%s]%s", ipa_begin, output, ipa_end) elseif args.ipa_brackets == "<" or args.ipa_brackets == ">" then return mw.ustring.format("⟨%s%s%s⟩", ipa_begin, output, ipa_end) elseif args.ipa_brackets == "/" then return mw.ustring.format("%s/%s/%s" , ipa_begin, output, ipa_end) else return mw.ustring.format("%s%s%s" , ipa_begin, output, ipa_end) end else return mw.ustring.format("%s%s%s" , ipa_begin, output, ipa_end) end end local function __soundbox() end function p.main(frame) -- discard empty strings to allow for comparison with neg operators; trim everything else -- accepted parameters are: -- name description -- ==== =========== -- (1) the input -- output the output, one of: input; name; wikipage; soundfile; type -- custom_output overrides `output` -- link `true` or any value to link -- link_to link to something other than the corresponding wikipage -- ipa `true` or any value to format in {{IPA}} -- ipa_brackets one of: [ or ]; < or >; / to enclose in brackets, angles or slashes, respectively -- soundbox `true` or any value for the customary soundbox -- soundbox_options anything that could go in after the filename -- everything other than the input is optional (but you'll probably nearly always want one of output or custom_output) for k, v in pairs(frame.args) do args[k] = v and mw.text.trim(v) end id = data.symbols[args[1]] output = args.custom_output or __output[args.output] and __output[args.output]() or "" if args.link then output = __link() end if args.ipa then output = __ipa() end if args.soundbox then output = __soundbox() end end return p |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。