پودمان:Documentation: تفاوت میان نسخه‌ها

پرش به ناوبری پرش به جستجو
جز (۱ نسخه واردشده)
(اگر چیزی ترکید، کاربر هنوز را بیابید.)
خط ۱: خط ۱:
-- برای فارسی‌سازی بهتر، بعضی از قسمت‌های این پودمان تغییر کرده‌است. لطفاً هنگام به‌روزرسانی به توضیحات پودمان توجه کنید.
-- This module implements {{documentation}}.
-- This module implements {{documentation}}.


خط ۳۳: خط ۳۴:
expectType = expectType or 'string'
expectType = expectType or 'string'
if type(msg) ~= expectType then
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
error('پیام: خطای نوع در متن cfg.' .. cfgKey .. ' (' .. expectType .. ' انتظار می‌رفت، ' .. type(msg) .. ' بدست آمد)', 2)
end
end
if not valArray then
if not valArray then
خط ۴۱: خط ۴۲:
local function getMessageVal(match)
local function getMessageVal(match)
match = tonumber(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
-- برای فارسی‌سازی بهتر، ساختار خطای نمایشی خط زیر تغییر کرده‌است
return valArray[match] or error('پیام: هیچ مقداری برای کلید $' .. match .. ' در متن cfg.' .. cfgKey .. ' یافت نشد', 4)
end
end


خط ۱۲۹: خط ۱۳۱:
local root = mw.html.create()
local root = mw.html.create()
root
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:wikitext(p.sandboxNotice(args, env))
خط ۳۰۸: خط ۳۱۱:
if templateTitle.exists and sandboxTitle.exists then
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.fullUrl(
local compareUrl = mw.uri.fullUrl(
'Special:ComparePages',
'ویژه:مقایسهٔ صفحات',
{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
)
خط ۳۲۳: خط ۳۲۶:
-- Auxiliary templates
-- Auxiliary templates
----------------------------------------------------------------------------
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext =  package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end


function p.sandboxNotice(args, env)
function p.sandboxNotice(args, env)
خط ۹۴۱: خط ۹۵۵:
end
end
local subpagesLink = makeWikilink(
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
'ویژه:نمایه پیشوندی/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
message('subpages-link-display', {pagetype})
)
)