پودمان:Template link general: تفاوت میان نسخه‌ها

جز
بدون خلاصۀ ویرایش
(implement sandbox fix for nowiki issues (TPER))
جزبدون خلاصۀ ویرایش
خط ۱۳: خط ۱۳:
local i, _ = s:find(':', 1, true)
local i, _ = s:find(':', 1, true)
if i == nil then
if i == nil then
return 'Template:' .. s
return 'الگو:' .. s
end
end
local ns = s:sub(1, i - 1)
local ns = s:sub(1, i - 1)
خط ۱۹: خط ۱۹:
return s
return s
else
else
return 'Template:' .. s
return 'الگو:' .. s
end
end
end
end


local function trimTemplate(s)
local function trimTemplate(s)
local needle = 'template:'
local needle = 'الگو:'
if s:sub(1, needle:len()):lower() == needle then
if s:sub(1, needle:len()):lower() == needle then
return s:sub(needle:len() + 1)
return s:sub(needle:len() + 1)
خط ۴۱: خط ۴۱:
if args['1'] then
if args['1'] then
-- This handles :Page and other NS
-- This handles :Page and other NS
titleObj = mw.title.new(args['1'], 'Template')
titleObj = mw.title.new(args['1'], 'الگو')
else
else
titleObj = mw.title.getCurrentTitle()
titleObj = mw.title.getCurrentTitle()
خط ۵۲: خط ۵۲:
if not _ne(textPart) then
if not _ne(textPart) then
if titleObj ~= nil then
if titleObj ~= nil then
textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText
textPart = titleObj:inNamespace("الگو") and args['1'] or titleObj.fullText
else
else
-- redlink
-- redlink
خط ۶۱: خط ۶۱:
if _ne(args.subst) then
if _ne(args.subst) then
-- HACK: the ns thing above is probably broken
-- HACK: the ns thing above is probably broken
textPart = 'subst:' .. textPart
textPart = 'جا:' .. textPart
end
end
کاربر ناشناس