Difference between revisions of "Module:Extension"

Jump to navigation Jump to search
595 bytes added ,  09:10, 2 July 2021
Add getMediaWikiRequirement() function.
>Tacsipacsi
(Undo revision 4389935 by DannyS712 (talk): this isn’t going to work: extension.json is read only for the master branch, but the extension may support older versions on other branches)
>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
Anonymous user

Navigation menu