Difference between revisions of "Module:Extension"
Add getMediaWikiRequirement() function.
>Tacsipacsi |
>Samwilson (Add getMediaWikiRequirement() function.) |
||
Line 294: | Line 294: | ||
return '' | return '' | ||
end | end | ||
-- -- | |||
-- Get the requires.MediaWiki value from extension.json | |||
-- @link https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#requires | |||
-- -- | |||
function p.getMediaWikiRequirement( frame ) | |||
-- If the first arg is given, it'll be the manual override value. | |||
if frame.args[1] ~= nil and mw.text.trim( frame.args[1] ) ~= "" then | |||
return frame.args[1] | |||
end | |||
-- Otherwise, look it up from extension.json. | |||
local data = getExtData() | |||
if data and data.requires and data.requires.MediaWiki then | |||
return data.requires.MediaWiki | |||
end | |||
-- If neither are given, return nothing. | |||
return '' | |||
end | |||
function p.getHooks(frame) | function p.getHooks(frame) | ||
local hookOutput = frame.args.header | local hookOutput = frame.args.header |