Difference between revisions of "Module:Extension"

811 bytes removed ,  08:11, 26 April 2016
generalised the use of “+” as “ or later”, as specified in SPDX 2.0; removed explicit .*\+$ licenses; change tested in the debugging console and on some pages; this change will simplify translation of the “ or later”
>Seb35
(+CC-BY-SA-2.5, added "or later" versions for CC-BY-SA licenses)
>Seb35
(generalised the use of “+” as “ or later”, as specified in SPDX 2.0; removed explicit .*\+$ licenses; change tested in the debugging console and on some pages; this change will simplify translation of the “ or later”)
Line 22: Line 22:
}
}
local licenses = {
local licenses = {
['GPL-2.0']      = { '[' .. addr.GNU .. 'gpl-2.0.html GNU General Public License 2.0]', 'GPL' },
['GPL-2.0']      = { '[' .. addr.GNU .. 'gpl-2.0.html GNU General Public License 2.0]', 'GPL' },
['GPL-2.0+']      = { '[' .. addr.GNU .. 'gpl-2.0.html GNU General Public License 2.0] or later', 'GPL' },
['GPL-3.0']      = { '[' .. addr.GNU .. 'gpl-3.0.html GNU General Public License 3.0]', 'GPL' },
['GPL-3.0']      = { '[' .. addr.GNU .. 'gpl-3.0.html GNU General Public License 3.0]', 'GPL' },
['AGPL-3.0']    = { '[' .. addr.GNU .. 'agpl-3.0.html GNU Affero General Public License 3.0]', 'AGPL' },
['GPL-3.0+']      = { '[' .. addr.GNU .. 'gpl-3.0.html GNU General Public License 3.0] or later', 'GPL' },
['LGPL-2.1']    = { '[' .. addr.GNU .. 'lgpl-2.1.html GNU Lesser General Public License 2.1]', 'LGPL' },
['AGPL-3.0']      = { '[' .. addr.GNU .. 'agpl-3.0.html GNU Affero General Public License 3.0]', 'AGPL' },
['LGPL-3.0']    = { '[' .. addr.GNU .. 'lgpl-3.0.html GNU Lesser General Public License 3.0]', 'LGPL' },
['AGPL-3.0+']    = { '[' .. addr.GNU .. 'agpl-3.0.html GNU Affero General Public License 3.0] or later', 'AGPL' },
['FDL']         = { '[' .. addr.GNU .. 'fdl.html GNU Free Documentation License]' },
['LGPL-2.1']      = { '[' .. addr.GNU .. 'lgpl-2.1.html GNU Lesser General Public License 2.1]', 'LGPL' },
['MIT']         = { '[' .. addr.OSI .. 'mit-license.php MIT License]', 'MIT' },
['LGPL-2.1+']    = { '[' .. addr.GNU .. 'lgpl-2.1.html GNU Lesser General Public License 2.1] or later', 'LGPL' },
['ISC']         = { '[' .. addr.OSI .. 'ISC ISC License]', 'ISC' },
['LGPL-3.0']      = { '[' .. addr.GNU .. 'lgpl-3.0.html GNU Lesser General Public License 3.0]', 'LGPL' },
['BSD-2-Clause'] = { '[' .. addr.OSI .. 'BSD-2-Clause BSD 2-clause "Simplified" License]', 'BSD' },
['LGPL-3.0+']    = { '[' .. addr.GNU .. 'lgpl-3.0.html GNU Lesser General Public License 3.0] or later', 'LGPL' },
['BSD-3-Clause'] = { '[' .. addr.OSI .. 'BSD-3-Clause BSD 3-clause "Modified" License]', 'BSD' },
['FDL']           = { '[' .. addr.GNU .. 'fdl.html GNU Free Documentation License]' },
['BSD-4-Clause'] = { '[' .. addr.GNU .. 'license-list.html#OriginalBSD BSD-4-Clause BSD 4-clause "Original" License]', 'BSD' },
['MIT']           = { '[' .. addr.OSI .. 'mit-license.php MIT License]', 'MIT' },
['MPL-1.0']     = { '[' .. addr.Mozilla .. 'MPL/1.0/ Mozilla Public License 1.0]', 'MPL' },
['ISC']           = { '[' .. addr.OSI .. 'ISC ISC License]', 'ISC' },
['MPL-2.0']     = { '[' .. addr.Mozilla .. 'MPL/2.0/ Mozilla Public License 2.0]', 'MPL' },
['BSD-2-Clause'] = { '[' .. addr.OSI .. 'BSD-2-Clause BSD 2-clause "Simplified" License]', 'BSD' },
['WTFPL']       = { '[http://www.wtfpl.net WTFPL 2.0]', 'WTFPL' },
['BSD-3-Clause'] = { '[' .. addr.OSI .. 'BSD-3-Clause BSD 3-clause "Modified" License]', 'BSD' },
['Apache-2.0']   = { '[http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0]', 'Apache' },
['BSD-4-Clause'] = { '[' .. addr.GNU .. 'license-list.html#OriginalBSD BSD-4-Clause BSD 4-clause "Original" License]', 'BSD' },
['Zlib']         = { '[' .. addr.OSI .. 'Zlib zlib License]' },
['MPL-1.0']       = { '[' .. addr.Mozilla .. 'MPL/1.0/ Mozilla Public License 1.0]', 'MPL' },
['CC0-1.0']     = { '[//creativecommons.org/publicdomain/zero/1.0/ Creative Commons Zero v1.0 Universal]' },
['MPL-2.0']       = { '[' .. addr.Mozilla .. 'MPL/2.0/ Mozilla Public License 2.0]', 'MPL' },
['CC-BY-3.0']   = { '[' .. addr.CC .. 'by/3.0/ Creative Commons Attribution 3.0]', 'CC' },
['WTFPL']         = { '[http://www.wtfpl.net WTFPL 2.0]', 'WTFPL' },
['CC-BY-SA-2.0'] = { '[' .. addr.CC .. 'by-sa/2.0/ Creative Commons Attribution Share Alike 2.0]', 'CC' },
['Apache-2.0']   = { '[http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0]', 'Apache' },
['CC-BY-SA-2.5'] = { '[' .. addr.CC .. 'by-sa/2.5/ Creative Commons Attribution Share Alike 2.5]', 'CC' },
['Zlib']         = { '[' .. addr.OSI .. 'Zlib zlib License]' },
['CC-BY-SA-3.0'] = { '[' .. addr.CC .. 'by-sa/3.0/ Creative Commons Attribution Share Alike 3.0]', 'CC' },
['CC0-1.0']       = { '[//creativecommons.org/publicdomain/zero/1.0/ Creative Commons Zero v1.0 Universal]' },
['CC-BY-SA-4.0'] = { '[' .. addr.CC .. 'by-sa/4.0/ Creative Commons Attribution Share Alike 4.0]', 'CC' },
['CC-BY-3.0']     = { '[' .. addr.CC .. 'by/3.0/ Creative Commons Attribution 3.0]', 'CC' },
['ECL-2.0']     = { '[[wikipedia:Educational Community License|Educational Community License 2.0]]', 'ECL' },
['CC-BY-SA-2.0'] = { '[' .. addr.CC .. 'by-sa/2.0/ Creative Commons Attribution Share Alike 2.0]', 'CC' },
['PD']           = { '[[wikipedia:Public domain|Public domain]]', 'PD' },
['CC-BY-SA-2.0+'] = { '[' .. addr.CC .. 'by-sa/2.0/ Creative Commons Attribution Share Alike 2.0] or later', 'CC' },
['CC-BY-SA-2.5']  = { '[' .. addr.CC .. 'by-sa/2.5/ Creative Commons Attribution Share Alike 2.5]', 'CC' },
['CC-BY-SA-2.5+'] = { '[' .. addr.CC .. 'by-sa/2.5/ Creative Commons Attribution Share Alike 2.5] or later', 'CC' },
['CC-BY-SA-3.0'] = { '[' .. addr.CC .. 'by-sa/3.0/ Creative Commons Attribution Share Alike 3.0]', 'CC' },
['CC-BY-SA-3.0+'] = { '[' .. addr.CC .. 'by-sa/3.0/ Creative Commons Attribution Share Alike 3.0] or later', 'CC' },
['CC-BY-SA-4.0'] = { '[' .. addr.CC .. 'by-sa/4.0/ Creative Commons Attribution Share Alike 4.0]', 'CC' },
['CC-BY-SA-4.0+'] = { '[' .. addr.CC .. 'by-sa/4.0/ Creative Commons Attribution Share Alike 4.0] or later', 'CC' },
['ECL-2.0']       = { '[[wikipedia:Educational Community License|Educational Community License 2.0]]', 'ECL' },
['PD']           = { '[[wikipedia:Public domain|Public domain]]', 'PD' },
}
}
local types = {
local types = {
Line 156: Line 147:


local function getLicenseCategory( str )
local function getLicenseCategory( str )
if mw.ustring.sub( str, -1 ) == '+' then
str = mw.ustring.sub( str, 1, -2 )
end
local cnf = licenses[str]
local cnf = licenses[str]
if cnf then
if cnf then
Line 167: Line 161:


local function getFormattedLicense( str )
local function getFormattedLicense( str )
local cnf = licenses[str]
local orlater = ''
local license = str
if mw.ustring.sub( str, -1 ) == '+' then
license = mw.ustring.sub( str, 1, -2 )
orlater = ' or later'
end
local cnf = licenses[license]
if cnf then
if cnf then
return cnf[1]
return cnf[1] .. orlater
else
else
return str
return str
Anonymous user