This module implements the template {{phrasebook}}
.
local format_categories = require("Module:utilities").format_categories
local get_lang = require("Module:languages").getByCode
local html_create = mw.html.create
local insert = table.insert
local process_params = require("Module:parameters").process
local pagename = mw.loadData("Module:headword/data").encoded_pagename
local export = {}
function export.show(frame)
local args = process_params(frame:getParent().args, {
= {required = true},
= {list = true}
})
local lang = get_lang(args)
local langname = lang:getCanonicalName()
local categories = {}
local main = html_create("td"):wikitext("This entry is part of the ] project, which presents ] based on utility, simplicity and commonness.")
insert(categories, langname .. " phrasebook")
if #args > 0 then
local topics = {}
for _, topic in ipairs(args) do
insert(topics, "<b>]</b>")
insert(categories, langname .. " phrasebook/" .. topic)
end
main = main:tag("div")
:wikitext("For other " .. langname .. " entries on this topic, see " .. mw.text.listToText(topics, ", ", " or ") .. ".")
:allDone()
end
local div = html_create("div")
:addClass("phrasebook NavFrame")
:css("background-color", "var(--wikt-palette-orange,#f2caa4)")
:tag("div")
:addClass("NavHead")
:css("background", "var(--wikt-palette-lightyellow,#FFFFE0)")
:wikitext(langname .. " phrasebook")
:done()
:tag("div")
:addClass("NavContent")
:tag("table")
:css("background", "var(--wikt-palette-lightyellow,#FFFFE0)")
:css("width", "100%")
:css("margin", "auto")
:css("text-align", "center")
:tag("tr")
:tag("td")
:css("text-align", "left")
:wikitext("]")
:node(main)
:allDone()
return tostring(div) .. format_categories(categories, lang, nil, pagename)
end
return export