Module:hyphenation: difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
No edit summary Tags: Mobile edit Mobile web edit |
||
Line 2: | Line 2: | ||
local categorise_syllables = { |
local categorise_syllables = { |
||
["en"] = true, |
|||
["es"] = true, |
["es"] = true, |
||
["fr"] = true, |
["fr"] = true, |
Revision as of 12:38, 2 January 2017
- The following documentation is located at Module:hyphenation/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox (diff)
Implements {{hyphenation}}
.
Detailed documentation
export.hyphenation
function export.hyphenation(frame)
This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.
local export = {}
local categorise_syllables = {
["en"] = true,
["es"] = true,
["fr"] = true,
["it"] = true,
["pt"] = true,
}
function export.hyphenation(frame)
local params = {
[1] = {list = true, required = true, default = "{{{1}}}"},
["caption"] = {},
["lang"] = {required = true, default = "und"},
["nocaption"] = {type = "boolean"},
["sc"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = require("Module:languages").getByCode(args["lang"]) or error("The language code \"" .. args["lang"] .. "\" is not valid.")
local sc = args["sc"] and (require("Module:scripts").getByCode(args["sc"]) or error("The script code \"" .. sc .. "\" is not valid.")) or nil
local text = require("Module:links").full_link({lang = lang, sc = sc, alt = table.concat(args[1], "‧"), tr = "-"})
local category = ""
if categorise_syllables[lang:getCode()] then
category = require("Module:utilities").format_categories({lang:getCanonicalName() .. " " .. tostring(#args[1]) .. "-syllable words"}, lang)
end
return (args["nocaption"] and "" or (args["caption"] or "Hyphenation") .. ": ") .. text .. category
end
return export