کاربر ناشناس
پودمان: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 ' | 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 ' | return 'الگو:' .. s | ||
end | end | ||
end | end | ||
local function trimTemplate(s) | local function trimTemplate(s) | ||
local needle = ' | 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'], ' | 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(" | 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 = ' | textPart = 'جا:' .. textPart | ||
end | end | ||