Module:RootFinder: Difference between revisions
From The Seven Sages of Rome
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
local mw = require('mw') | local mw = require('mw') | ||
function p.getVariety(page | function p.getVariety(frame) | ||
local page = frame.args[1] -- Extract the first argument from the frame | |||
if not page or page == "" then | if not page or page == "" then | ||
return "Error: No page name provided." | return "Error: No page name provided." | ||
| Line 8: | Line 10: | ||
-- Query Semantic MediaWiki for the property "Is Variety Of" | -- Query Semantic MediaWiki for the property "Is Variety Of" | ||
local result = mw.smw.ask{"[[" .. page .. " | local result = mw.smw.ask{"[[" .. page .. "]] |?Is Variety Of"} | ||
if result and result[page] and result[page]["Is Variety Of"] then | if result and result[page] and result[page]["Is Variety Of"] then | ||
Revision as of 14:34, 25 March 2025
Documentation for this module may be created at Module:RootFinder/doc
local p = {}
local mw = require('mw')
function p.getVariety(frame)
local page = frame.args[1] -- Extract the first argument from the frame
if not page or page == "" then
return "Error: No page name provided."
end
-- Query Semantic MediaWiki for the property "Is Variety Of"
local result = mw.smw.ask{"[[" .. page .. "]] |?Is Variety Of"}
if result and result[page] and result[page]["Is Variety Of"] then
return "Is Variety Of: " .. result[page]["Is Variety Of"]
else
return "No 'Is Variety Of' property found for " .. page
end
end
return p