پودمان:Labelled list hatnote: تفاوت میان نسخه‌ها

بدون خلاصۀ ویرایش
(Enhanced with the ability to vary the label based on the namespace(s) of the target page(s), from sandbox)
 
بدون خلاصۀ ویرایش
 
(۵ نسخهٔ میانی ویرایش شده توسط ۴ کاربر نشان داده نشد)
خط ۱۴: خط ۱۴:
-- Defaults global to this module
-- Defaults global to this module
local defaults = {
local defaults = {
label = 'See also', --Final fallback for label argument
label = 'انظر أيضًا', --Final fallback for label argument
labelForm = '%s: %s',
labelForm = '%s: %s',
prefixes = {'label', 'label ', 'l'},
prefixes = {'label', 'label ', 'l'},
خط ۳۵: خط ۳۵:
end
end
local page = display and
local page = display and
string.format('%s|%s', string.gsub(v, '|.*$', ''), display) or v
mw.ustring.format('%s|%s', mw.ustring.gsub(v, '|.*$', ''), display) or v
pages[#pages + 1] = page
pages[#pages + 1] = page
end
end
خط ۶۹: خط ۶۹:
if #pages == 0 then
if #pages == 0 then
return mHatnote.makeWikitextError(
return mHatnote.makeWikitextError(
'no page names specified',
'لم تُحدد أسماء صفحات',
(options.template or defaults.template) .. '#Errors',
(options.template or defaults.template) .. '#أخطاء',
options.category
options.category
)
)
خط ۸۵: خط ۸۵:
end
end
end
end
local text = string.format(
local text = mw.ustring.format(
options.labelForm or defaults.labelForm,
options.labelForm or defaults.labelForm,
label,
label,
۲۶٬۵۱۵

ویرایش