Module:File/Licenses
From Splatoon Fanon
Documentation for this module may be created at Module:File/Licenses/doc
local l = {}
---The list of licenses.
---As you may see below (on the `l.get_license()` function), the key NEEDS to
---not have spaces, dashes, dots, or underscores.
---
---@type table<string, string>
local licenses = {
ccbysa10 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-sa/1.0/deed.en Creative Commons Attribution-ShareAlike 1.0]''' license.''[[Category:Media licensed under CC BY-SA 1.0]]",
ccby20 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by/2.0/deed.en Creative Commons Attribution 2.0]''' license.''[[Category:Media licensed under CC BY-SA 2.0]]",
ccbysa21jp = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-sa/2.1/jp/deed.en Creative Commons Attribution-ShareAlike 2.1 Japan]''' license.''[[Category:Media licensed under CC BY-SA 2.1]]",
ccby25 = "''This file is distributed under the '''[http://creativecommons.org/licenses/by/2.5/deed.en Creative Commons Attribution 2.5]''' license.''[[Category:Media licensed under CC BY 2.5]]",
ccbysa25 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-sa/2.5/deed.en Creative Commons Attribution-ShareAlike 2.5]''' license.''[[Category:Media licensed under CC BY-SA 2.5]]",
ccby30 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by/3.0/deed.en Creative Commons Attribution 3.0]''' license.''[[Category:Media licensed under CC BY 3.0]]",
ccbync30 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-nc/3.0/ Creative Commons Attribution Non-Commercial 3.0]''' license.''[[Category:Media licensed under CC BY-NC 3.0]]",
ccbyncsa30 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons Attribution Non-Commercial 3.0]''' license.''[[Category:Media licensed under CC BY-NC-SA 3.0]]",
ccbysa30 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-sa/3.0/deed.en Creative Commons Attribution-ShareAlike 3.0]''' license.''[[Category:Media licensed under CC BY-SA 3.0]]",
ccby40 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by/4.0/deed.en Creative Commons Attribution 4.0]''' license.''[[Category:Media licensed under CC BY 4.0]]",
ccbysa40 = "''This file is distributed under the '''[https://creativecommons.org/licenses/by-sa/4.0/deed.en Creative Commons Attribution-ShareAlike 4.0]''' license.''[[Category:Media licensed under CC BY-SA 4.0]]",
lgpl = "This library is free software; you can redistribute it and/or modify it under the terms of the '''[[wikipedia:GNU Lesser General Public License|GNU Lesser General Public License]]''' as published by the [[wikipedia:Free Software Foundation|Free Software Foundation]]; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See [http://www.gnu.org/licenses/lgpl.html the GNU Lesser General Public License] for more details.",
pd = "''This file has been released into the '''[[Wikipedia:Public domain|public domain]]''' by the copyright holder, its copyright has expired, or it is ineligible for copyright. This applies worldwide.''[[Category:Media released to public domain]]",
pds = "''This file has been released into the '''[[Wikipedia:Public domain|public domain]]''' by the uploading user. This applies worldwide.''[[Category:Media released to public domain]]",
fairuse = "''This file is subject to [[Inkipedia:Copyrights|copyright]]. Copyright is most likely held by the company that published the game or the media portrayed. Inkipedia's use of this work qualifies as '''fair use''' under '''[[Wikipedia:Fair use#U.S. fair use factors|United States copyright law]]''', or the author's permission is given. It is used on the wiki only in the belief that the information the file portrays is designed to be an accompaniment to playing the game or media, and its use here will not:''<ol><li>''Detract from the experience of playing the game or using the media in question.''</li><li>''Harm the author's sales or reputation.''</li></ol>[[Category:Media assumed fair use]]",
}
---Because licenses are important, the idea here is to prevent as much as possible
---any spacing issues, dashes, underscores, among others, when typing the license
---name.
---
---Examples:
--- "cc-by-sa" -> "ccbysa"
--- "fair use" -> "fairuse"
--- "LGp_l" -> "lgpl"
--- "cc BY-4.0" -> "ccby40"
---
---@param input string
---@return string | nil
function l.get_license(input)
if not input then
return nil
end
local license = input:lower():gsub("[^%w]", "")
return licenses[input]
end
return l