Module:definition

--[=[

Module for implementing miscellaneous definition-line templates. Currently supports only &lit.

Author: Benwing2 ]=]--

local export = {}

local m_links = require("Module:links")

-- Uppercase first letter. local function ucfirst(text) return mw.ustring.upper(mw.ustring.sub(text, 1, 1)) .. mw.ustring.sub(text, 2) end

local function is_valid_page_name(pagename) return not not mw.title.new(pagename) end

-- Implementation of function export.and_lit(terms, qualifier, dot, nodot, nocap) local output = {} table.insert(output, ' ') if qualifier then table.insert(output, ucfirst(qualifier) .. " used") elseif nocap then table.insert(output, "used") else table.insert(output, "Used") end table.insert(output, " other than figuratively or idiomatically") if #terms > 0 then table.insert(output, "&#x3a; ") if terms[1].term == "-" or not is_valid_page_name(terms[1].term) then table.insert(output, terms[1].term) table.insert(output, "") else for i, term in ipairs(terms) do				if i == 1 then table.insert(output, "see ") else table.insert(output, ",&lrm; ") end table.insert(output, m_links.full_link(term, nil, nil)) end end else table.insert(output, "") end if not nodot then table.insert(output, dot or ".") end table.insert(output, " ") return table.concat(output) end

return export