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 = "2019-10-30",
                       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 s then
                 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 then
                   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 or "wikidata" or "~"
     --    atleast  -- string, with required version
     --                 or false
     --                         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
     -- 2019-10-15
     -- 2020-08-17
     local last = ( atleast == "~" )
    local since  = atleast
     local since = atleast
     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 entity = mw.wikibase.getEntity( string.format( "Q%d",
             local suited = string.format( "Q%d", item )
                                                                item ) )
            if link then
            if type( entity ) == "table" then
                r = suited
                local seek = Failsafe.serialProperty or "P348"
            else
                local vsn  = entity:formatPropertyValues( seek )
                local entity = mw.wikibase.getEntity( suited )
                if type( vsn ) == "table"  and
                if type( entity ) == "table" then
                  type( vsn.value ) == "string"  and
                    local seek = Failsafe.serialProperty or "P348"
                  vsn.value ~= "" then
                    local vsn  = entity:formatPropertyValues( seek )
                    if last  and  vsn.value == Failsafe.serial then
                    if type( vsn ) == "table"  and
                         r = false
                      type( vsn.value ) == "string"  and
                    else
                      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