Module:Strip version patch
Jump to navigation
Jump to search
File:Test Template Info-Icon - Version (2).svg Module documentation[view] [edit] [history] [purge]
| This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
Usage
[edit source]{{#invoke:Strip version patch|main|value}}
-- Strip only third component (patch) of a software version if present
-- For instance 6.16.1 as parameter will return 6.16
-- Used on [[Linux kernel version history]]
local p = {}
function p.main(frame)
local version = frame.args[1] or ''
local cleaned = mw.ustring.gsub(version, "^(%d+%.%d+)%.%d+$", "%1")
return cleaned
end
return p