Modul:Vorlage:LuaModuleDoc: Unterschied zwischen den Versionen
Modul:Vorlage:LuaModuleDoc (bearbeiten)
Version vom 24. November 2016, 09:18 Uhr
, 24. November 20162016-11-24
wp>PerfektesChaos (2016-11-16) |
wp>PerfektesChaos (2016-11-24) |
||
Zeile 1: | Zeile 1: | ||
local Serial = "2016-11- | 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 | local s, t | ||
if repo and repo.value and repo.value:find( "//" ) then | |||
if | |||
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 | t = mw.title.makeTitle( space, s ) | ||
s = "//" .. repo.host | |||
if mw.title.equals( CurrentTitle, t ) and | |||
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 | 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 |