Modul:Vorlage:LuaModuleDoc: Unterschied zwischen den Versionen

2016-11-24
(2016-11-16)
(2016-11-24)
Zeile 1: Zeile 1:
local Serial = "2016-11-16"
local Serial = "2016-11-24"
--[=[
--[=[
Support {{LuaModuleDoc}}
Support {{LuaModuleDoc}}
Zeile 25: Zeile 25:
     local r
     local r
     if entity then
     if entity then
        local mode = 0
         local repo = entity:formatPropertyValues( "P1324" )
         local repo = entity:formatPropertyValues( "P1324" )
         local s = LuaWiki.getArg( "categoryWikiData", "" )
         local s, t
        local t
         if repo and repo.value and repo.value:find( "//" ) then
         if #s > 0 then
            t = mw.title.makeTitle( "Category", s )
            if t.exists then
                r = string.format( "[[%s|%s]]",
                                  t.prefixedText, script )
            end
        end
        if repo and repo.value then
            local leader
             repo = mw.uri.new( repo.value )
             repo = mw.uri.new( repo.value )
             if repo  and  repo.path:match( "^/wiki/" ) then
             if repo  and  repo.path:match( "^/wiki/" ) then
Zeile 43: Zeile 35:
                                             "^([^:]+):(.+)$" )
                                             "^([^:]+):(.+)$" )
                 if space and s then
                 if space and s then
                     t     = mw.title.makeTitle( space, s )
                     t = mw.title.makeTitle( space, s )
                     leader = ( mw.title.equals( CurrentTitle, t )
                     s = "//" .. repo.host
                              and
                    if mw.title.equals( CurrentTitle, t ) and
                              mw.site.server == "//" .. repo.host )
                      mw.site.server:find( s, 1, true ) then
                        mode = 2
                    else
                        mode = 1
                    end
                 end
                 end
             end
             end
Zeile 52: Zeile 48:
             if #s > 0 then
             if #s > 0 then
                 local params
                 local params
                 if not leader then
                 if mode < 2 then
                     params = { [1] = string.format( "[%s %s]",
                     params = { [1] = string.format( "[%s %s]",
                                                     tostring( repo ),
                                                     tostring( repo ),
Zeile 60: Zeile 56:
                 r = r .. Frame:expandTemplate{ title=s,
                 r = r .. Frame:expandTemplate{ title=s,
                                               args=params }
                                               args=params }
            end
        end
        s = LuaWiki.getArg( "categoryWikiData", "" )
        if #s > 0 then
            t = false
            if mode > 0 then
                local sub
                if mode == 2 then
                    sub = "categoryWikiDataParent"
                else
                    sub = "categoryWikiDataChild"
                end
                sub = LuaWiki.getArg( sub, "" )
                if #sub > 0 then
                    t = mw.title.makeTitle( "Category", sub )
                    if not t.exists then
                        t = false
                    end
                end
            end
            if not t then
                t = mw.title.makeTitle( "Category", s )
                if not t.exists then
                    t = false
                end
            end
            if t then
                r = string.format( "[[%s|%s]]",
                                  t.prefixedText, script )
             end
             end
         end
         end
Zeile 442: Zeile 467:
function p.failsafe()
function p.failsafe()
     return Serial
     return Serial
end
end -- p.failsafe()


return p
return p
Anonymer Benutzer