Modul:WLink: Unterschied zwischen den Versionen
2016-07-20
wp>PerfektesChaos (2016-05-19) |
wp>PerfektesChaos (2016-07-20) |
||
Zeile 1: | Zeile 1: | ||
local WLink = { suite = "WLink", | local WLink = { suite = "WLink", | ||
serial = "2016- | serial = "2016-07-20" }; | ||
--[=[ | --[=[ | ||
ansiPercent() | ansiPercent() | ||
Zeile 28: | Zeile 28: | ||
isWikilink() | isWikilink() | ||
wikilink() | wikilink() | ||
failsafe() | |||
]=] | ]=] | ||
Zeile 774: | Zeile 775: | ||
-- Returns string, with first detected link target | -- Returns string, with first detected link target | ||
-- false if nothing found | -- false if nothing found | ||
local second = ".ac.co.gv.or."; | local second = ".ac.co.go.gv.or."; | ||
local r; | local r; | ||
if type( anURLutil ) == "table" then | if type( anURLutil ) == "table" then | ||
Zeile 1.015: | Zeile 1.016: | ||
-- table of assignments with { type, value} | -- table of assignments with { type, value} | ||
-- type is one of "lead", | -- type is one of "lead", | ||
-- "project", "lang", "ns", "space", "title" | -- "project", "lang", | ||
-- "ns", "space", "title" | |||
-- false if nothing found | -- false if nothing found | ||
local s = contentWikilink( attempt ); | local s = contentWikilink( attempt ); | ||
Zeile 1.080: | Zeile 1.082: | ||
return r; | return r; | ||
end -- WLink.wikilink() | end -- WLink.wikilink() | ||
function WLink.failsafe( assert ) | |||
-- Retrieve versioning and check for compliance | |||
-- Precondition: | |||
-- assert -- string, with required version, or false | |||
-- Postcondition: | |||
-- Returns string with appropriate version, or false | |||
local r; | |||
if assert and assert > WLink.serial then | |||
r = false; | |||
else | |||
r = WLink.serial; | |||
end | |||
return r | |||
end -- WLink.failsafe() | |||
Zeile 1.220: | Zeile 1.239: | ||
p.isWikilink = function ( frame ) | p.isWikilink = function ( frame ) | ||
return Template( frame, "isWikilink" ); | return Template( frame, "isWikilink" ); | ||
end | |||
p.failsafe = function ( frame ) | |||
local since = frame.args[ 1 ]; | |||
if since then | |||
since = mw.text.trim( since ); | |||
if since == "" then | |||
since = false; | |||
end | |||
end | |||
return WLink.failsafe( since ) or ""; | |||
end | end | ||
p.WLink = function () | p.WLink = function () |