Module:Concept: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (1 revision imported) |
(No difference)
|
Latest revision as of 21:22, 4 November 2021
Documentation for this module may be created at Module:Concept/doc
local yn = require('Module:Yesno')
local hc = require('Module:Paramtest').has_content
local p = {}
local nolinkargs = {
[1] = true,
['1'] = true,
link = true
}
function p.main(frame)
return p._main(frame:getParent().args)
end
function p._main(args)
local linkstr = ''
local str = "This is a [https://www.semantic-mediawiki.org/wiki/Help:Concepts semantic concept] which contains '''%s'''.\n\nIt functions similarly to a category but is based on a semantic mediawiki query, and can be used within other queries.%s"
local desc = "description missing"
if hc(args[1]) then
desc = mw.text.trim(args[1])
end
if yn(args.link or 'y', true) then
local linkquery = {
q=string.format('[[%s]]', mw.title.getCurrentTitle().fullText),
limit=500
}
for k,v in pairs(args) do
if not nolinkargs[k] then
linkquery[k] = v
end
end
linkstr = string.format('\n\n[%s Click here to view this concept with suggested printouts].', tostring(mw.uri.fullUrl('Special:Ask', linkquery)))
end
return string.format(str, desc, linkstr)
end
return p