Modul:Vorlage:LuaModuleDoc: Unterschied zwischen den Versionen
(2019-10-30) |
(2022-04-22) |
||
Zeile 1: | Zeile 1: | ||
local LuaModuleDoc = { suite = "LuaModuleDoc", | local LuaModuleDoc = { suite = "LuaModuleDoc", | ||
serial = " | serial = "2022-04-22", | ||
item = 12981914, | item = 12981914, | ||
frame = false, | frame = false, | ||
Zeile 147: | Zeile 147: | ||
local params, s | local params, s | ||
if type( repo ) == "table" and | if type( repo ) == "table" and | ||
type( repo.value) == "string" and | type( repo.value ) == "string" and | ||
repo.value:find( "//" ) then | repo.value:find( "//" ) then | ||
local t = mw.text.split( repo.value, ",%s+" ) | local t = mw.text.split( repo.value, ",%s+" ) | ||
Zeile 168: | Zeile 168: | ||
local space | local space | ||
space, s = repo.path:sub( 7 ):match( "^([^:]+):(.+)$" ) | space, s = repo.path:sub( 7 ):match( "^([^:]+):(.+)$" ) | ||
if space and | if space and | ||
mw.site.namespaces[ space ] then | |||
t = mw.title.makeTitle( space, s ) | t = mw.title.makeTitle( space, s ) | ||
s = "//" .. repo.host | s = "//" .. repo.host | ||
Zeile 215: | Zeile 216: | ||
if fetch( "forkedGlobal", "0" ) ~= "1" and | if fetch( "forkedGlobal", "0" ) ~= "1" and | ||
params.version and params.here and | params.version and params.here and | ||
params.version ~= params.here | params.version ~= params.here then | ||
params.update = "1" | params.update = "1" | ||
end | end | ||
Zeile 671: | Zeile 672: | ||
-- Retrieve versioning and check for compliance | -- Retrieve versioning and check for compliance | ||
-- Precondition: | -- Precondition: | ||
-- atleast -- string, with required version | -- atleast -- string, with required version | ||
-- | -- or wikidata|item|~|@ or false | ||
-- Postcondition: | -- Postcondition: | ||
-- Returns string -- with queried version, also if problem | -- Returns string -- with queried version/item, also if problem | ||
-- false -- if appropriate | -- false -- if appropriate | ||
-- | -- 2020-08-17 | ||
local last | local since = atleast | ||
local since = | local last = ( since == "~" ) | ||
local linked = ( since == "@" ) | |||
local link = ( since == "item" ) | |||
local r | local r | ||
if last or since == "wikidata" then | if last or link or linked or since == "wikidata" then | ||
local item = Failsafe.item | local item = Failsafe.item | ||
since = false | since = false | ||
if type( item ) == "number" and item > 0 then | if type( item ) == "number" and item > 0 then | ||
local | local suited = string.format( "Q%d", item ) | ||
if link then | |||
r = suited | |||
else | |||
local entity = mw.wikibase.getEntity( suited ) | |||
if type( entity ) == "table" then | |||
local seek = Failsafe.serialProperty or "P348" | |||
local vsn = entity:formatPropertyValues( seek ) | |||
if type( vsn ) == "table" and | |||
r = false | type( vsn.value ) == "string" and | ||
vsn.value ~= "" then | |||
r = vsn.value | if last and vsn.value == Failsafe.serial then | ||
r = false | |||
elseif linked then | |||
if mw.title.getCurrentTitle().prefixedText | |||
== mw.wikibase.getSitelink( suited ) then | |||
r = false | |||
else | |||
r = suited | |||
end | |||
else | |||
r = vsn.value | |||
end | |||
end | end | ||
end | end |