Modul:Getlinks
Bu modul uchun Modul:Getlinks/doc nomli hujjat sahifasini yaratishingiz mumkin
local p = {}
function p.links(frame)
local pframe = frame:getParent();
local config = frame.args;
local args = pframe.args;
local result = {};
local i = 1;
for s in mw.ustring.gmatch(config[1], "%[%[.-%]%]") do
s=mw.ustring.gsub(s, "%|.*","]]");
s=mw.ustring.gsub(s, "%#.*","]]");
if (not mw.ustring.match(s, "%[%[.-%:") ) then
result[i] = s;
i=i+1;
end
end
local h = {};
local res2 = {};
for i,v in ipairs(result) do
if (not h[v]) then
res2[#res2+1] = v;
h[v] = true;
end
end
result=res2;
if config['sort'] then
table.sort(result);
end
if config['sep'] then
sep=args['sep'];
else
sep = " • ";
end
return table.concat( result, sep)
end
return p;