Content deleted Content added
create |
fix |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1:
local c = {
disambig_magic_word = '__DISAMBIG__',
template_ambiguous = 'R from sort name/ambiguous',▼
template_unambiguous = 'R from sort name/unambiguous',
▲ template_ambiguous = 'R from sort name/ambiguous',
cat_unambiguous_from = 'Category:Redirects from sort names',
cat_unambiguous_to = 'Category:Redirects from sort names by article title',
cat_ambiguous_from = 'Category:Redirects from ambiguous sort names',
cat_ambiguous_to = 'Category:Redirects from ambiguous sort names by article title',
err_not_redirect = '[[Template:R from sort name]] error: page is not a redirect',
}
local remove_accents = require('Module:Latin')._removeaccents
local category = function(category, chr)
return '[[' .. category .. ', ' .. remove_accents(chr) .. ']]'
end
local p = {}
Line 12 ⟶ 21:
if title.exists then
if title.isRedirect then
char_from = mw.ustring.sub(title.fullText, 1, 1)
char_to = mw.ustring.sub(title.redirectTarget.fullText, 1, 1)
if mw.ustring.find(
frame:preprocess(
Line 20 ⟶ 31:
true
) then
return
frame:expandTemplate{title = c.template_ambiguous} ..
category(c.cat_ambiguous_from, char_from) ..
}▼
category(c.cat_ambiguous_to, char_to)
else
return
frame:expandTemplate{title = c.
category(c.cat_unambiguous_from, char_from) ..
}▼
category(c.cat_unambiguous_to, char_to)
end
else
Line 32 ⟶ 47:
end
else
return
title = c.template_unambiguous
}
end
end
|