Изменения

обработка перенаправлений — перенос изменений user:Vcohen из Модуль:ФИО/песочница
Строка 119: Строка 119:  
for i, v in ipairs(get_items(title)) do
 
for i, v in ipairs(get_items(title)) do
 
link, label = find_disambig(v, categories, false, nocat)
 
link, label = find_disambig(v, categories, false, nocat)
if link and link ~= title and link ~= current_title_obj.text then
+
if link then
lNum = lNum + 1
+
local t = mw.title.new(link)
hatnote_args[lNum], hatnote_args['l' .. lNum] = link, label
+
if t.isRedirect then
 +
link = t.redirectTarget.text
 +
end
 +
if link ~= title and link ~= current_title_obj.text then
 +
local found = false
 +
for ii, vv in ipairs(hatnote_args) do
 +
if link == vv then
 +
found=true
 +
end
 +
end
 +
if not found then
 +
lNum = lNum + 1
 +
hatnote_args[lNum], hatnote_args['l' .. lNum] = link, label
 +
end
 +
end
 
end
 
end
 
end
 
end
Анонимный участник