Module:fi-dialects/template/common
Appearance
- The following documentation is located at Module:fi-dialects/template/common/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
Implements common features for {{fi-dial}}
and {{fi-dial-map}}
.
local export = {}
local m_links = require("Module:links")
local m_parse_utilities = require("Module:parse utilities")
local lang = require("Module:languages").getByCode("fi")
export.specials = { "standard", "common", "colloquial" }
export.special = {
["standard"] = "Standard Finnish",
["common"] = "Most common form <small>(found across dialects, including possibly some of the ones listed below)</small>",
["colloquial"] = "(Urban) Colloquial Finnish"
}
export.disclaimer = "The classification of and data for regional dialects is based on pre-1950s data. Since the 1950s, the dialects have become increasingly mixed, levelled and influenced by Standard Finnish. Besides Standard Finnish, a relatively uniform and originally urban 'colloquial Finnish' is beginning to emerge in their place, especially in the cities."
function export.mention(term, gloss, usage)
return m_links.full_link({ term = term, lang = lang, gloss = gloss, pos = usage }, "term")
end
function export.link(term, alt, id)
return m_links.full_link({ term = term, lang = lang, alt = alt, id = id })
end
function export.tag(term)
return require("Module:script utilities").tag_text(term, lang)
end
function export.parse_term(term)
if mw.ustring.find(term, "<") then
local function generate_obj(text, parse_err_or_paramname)
return { text = text }
end
local parsed = m_parse_utilities.parse_inline_modifiers(term, { param_mods = { id = { } }, generate_obj = generate_obj })
return parsed.text, parsed.id
end
return term, nil
end
function export.extract_text(term)
return (export.parse_term(term))
end
function export.make_link(term, alt, id)
return export.link(term, alt, id)
end
function export.format_sources(sources, include_background_source)
if not sources or not sources[1] then
return ""
end
local data = mw.loadData("Module:fi-dialects/data/source")
local heading = #sources == 1 and "Source" or "Sources"
local list = {}
for _, source in ipairs(sources) do
table.insert(list, data[source] or ("<" .. source .. ">"))
end
if include_background_source then
table.insert(list, "see the information for the [[commons:File:Finnish dialect location map.svg#Summary|background image]] for its sources and licensing")
end
return "<p><small>" .. heading .. ": " .. table.concat(list, "; ") .. "</small></p>"
end
function export.get_sort_key(term)
return (lang:makeSortKey(term))
end
return export