Module:siwa-headword: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
local getArgs = require('Module:Arguments').getArgs
local export = {}
local export = {}


Line 10: Line 12:
-- This is the only function that can be invoked from a template.
-- This is the only function that can be invoked from a template.
function export.show(frame)
function export.show(frame)
local fargs = frame:getParent().args
local args = getArgs(frame)
-- The part of speech. This is also the name of the category that
-- The part of speech. This is also the name of the category that
Line 16: Line 18:
-- because you sometimes want something to behave as an adjective without
-- because you sometimes want something to behave as an adjective without
-- putting it in the adjectives category.
-- putting it in the adjectives category.
local poscat = frame.fargs[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local poscat = args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local PAGENAME = mw.title.getCurrentTitle().text
local PAGENAME = mw.title.getCurrentTitle().text
local params = {
[1] = { default = PAGENAME },
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local head = args[1]
local head = args[2] or PAGENAME
if head == "" then
if head == "" then head = nil end
head = nil
end
--local data = {lang = lang, pos_category = (postype and postype .. " " or "") .. poscat, categories = {}, heads = {head}, genders = {}, inflections = {}}
--local data = {lang = lang, pos_category = (postype and postype .. " " or "") .. poscat, categories = {}, heads = {head}, genders = {}, inflections = {}}

Navigation menu