Difference between revisions of "Module:Gerrit"
MyWikiBiz, Author Your Legacy — Thursday September 11, 2025
Jump to navigationJump to search (Pywikibot 6.4.0) |
(No difference)
|
Latest revision as of 21:52, 15 July 2021
Implements {{gerrit}}
local p = {} p.link = function (frame) local hash = frame.args[1] local length = string.len(hash) if not string.match(hash, '^I?%x+$' ) then return hash end local text if length > 14 then text = string.format("%.7s", hash) else text = hash end local url if length > 6 then -- query url = 'https://gerrit.wikimedia.org/r/q/' .. mw.uri.encode(hash) else -- probably a change url = 'https://gerrit.wikimedia.org/r/c/' .. hash .. '/' end return '<span class=plainlinks style="font-family: Consolas, Liberation Mono, Courier, monospace; text-decoration: none;">[' .. url .. ' ' .. text .. ']</span>' end return p