Modul:WLink: Unterschied zwischen den Versionen
update
wp>PerfektesChaos (update) |
wp>PerfektesChaos (update) |
||
Zeile 1: | Zeile 1: | ||
--[=[ 2014-11- | --[=[ 2014-11-26 | ||
WLink | WLink | ||
ansiPercent() | ansiPercent() | ||
Zeile 544: | Zeile 544: | ||
-- false if no project language found | -- false if no project language found | ||
local r = false; | local r = false; | ||
local s, m = | local s, m = WLink.getTarget( attempt ); | ||
if m == 2 then | |||
local w = WLink.wikilink( s ); | |||
if w and w.lang then | |||
r = w.lang; | |||
end | |||
end | |||
return r; | return r; | ||
end -- WLink.getLanguage() | end -- WLink.getLanguage() | ||
Zeile 558: | Zeile 564: | ||
-- false if no namespace found | -- false if no namespace found | ||
local r = false; | local r = false; | ||
local s, m = | local s, m = WLink.getTarget( attempt ); | ||
if m == 2 then | |||
local w = WLink.wikilink( s ); | |||
if w and not w.lang and not w.project and w.ns then | |||
r = w.ns; | |||
end | |||
end | |||
return r; | return r; | ||
end -- WLink.getNamespace() | end -- WLink.getNamespace() | ||
Zeile 633: | Zeile 645: | ||
function WLink.getProject( attempt ) | function WLink.getProject( attempt ) | ||
-- Retrieve project identifier | -- Retrieve wikifarm project identifier | ||
-- Precondition: | -- Precondition: | ||
-- attempt -- string, with wikilink or page title | -- attempt -- string, with wikilink or page title | ||
Zeile 640: | Zeile 652: | ||
-- false if no project identifier found | -- false if no project identifier found | ||
local r = false; | local r = false; | ||
local s, m = WLink.getTarget( attempt ); | |||
if m == 2 then | |||
local w = WLink.wikilink( s ); | |||
if w and w.project then | |||
r = w.project; | |||
end | |||
end | |||
return r; | return r; | ||
end -- WLink.getProject() | end -- WLink.getProject() |