Module:ja-blend
Appearance
- The following documentation is located at Module:ja-blend/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
Used by Template:ja-blend. See there for details.
Requiring Module:parameters, Module:ja-link.
local export = {}
local link = require('Module:ja-link').link
-- [[Module:parameters]]
function export.show(frame)
local args = require("Module:parameters").process(frame:getParent().args, {
[1] = {list = true, allow_holes = true},
["t"] = {list = true, allow_holes = true},
["rom"] = {list = true, allow_holes = true},
["pos"] = {list = true, allow_holes = true},
["lit"] = {list = true, allow_holes = true},
["linkto"] = {list = true, allow_holes = true},
["sort"] = {},
["nocat"] = {},
["nocap"] = {},
["notext"] = {},
})
local len = (args[1].maxindex + 1) / 2
local result = {}
local sort = ""
for i = 1, len do
table.insert(result, link({
lemma = args[1][i * 2 - 1],
kana = args[1][i * 2],
gloss = args['t'][i],
transliteration = args['rom'][i],
lit = args['lit'][i],
linkto = args['linkto'][i],
pos = args['pos'][i],
}, {}))
sort = sort .. mw.ustring.gsub(args[1][2*i] or args[1][2*i-1], "[%^%-%% ]", "")
end
return (args["notext"] and "" or ("[[Appendix:Glossary#blend|" .. ((args["nocap"] and "b" or "B") .. "lend]] of " ))) .. table.concat(result, " + ") .. (args["nocat"] and "" or ("[[Category:Japanese blends|" .. (args["sort"] or sort) .. "]]"))
end
return export