پودمان: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('پیام: خطای نوع در متن cfg.' .. cfgKey .. ' (' .. expectType .. ' انتظار می‌رفت، ' .. type(msg) .. ' بدست آمد)', 2)
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. 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


return ugsub(msg, '$([1-9۱-۹][0-9۰-۹]*)', getMessageVal)
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
end


خط ۹۸: خط ۹۶:
valueFunc = function (key, value)
valueFunc = function (key, value)
if type(value) == 'string' then
if type(value) == 'string' then
value = mw.ustring.match(value, '^%s*(.-)%s*$') -- Remove whitespace.
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
if key == 'heading' or value ~= '' then
return value
return value
خط ۱۱۸: خط ۱۱۶:


function p.nonexistent(frame)
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'آزمایشی' then
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'هشدار صفحه آزمایشی پودمان'}
return frame:expandTemplate{title = 'module test cases notice'}
else
else
return p.main(frame)
return p.main(frame)
خط ۱۴۱: خط ۱۳۹:
-- 'documentation-container'
-- 'documentation-container'
:addClass(message('container'))
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:newline()
:tag('div')
:tag('div')
خط ۳۱۳: خط ۳۱۴:
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}
)
)
خط ۳۵۱: خط ۳۵۲:
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-template' --> '[[امامت‌پدیا:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[امامت‌پدیا:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-compare-link-display' --> 'diff'
خط ۴۶۱: خط ۴۶۲:
env = env or p.getEnvironment(args)
env = env or p.getEnvironment(args)
local links
local links
local content = args.content or args['محتوا']
local content = args.content
if not content or args[1] then
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
-- No need to include the links if the documentation is on the template page itself.
خط ۴۹۰: خط ۴۹۱:
-- 'history-link-display' --> 'history'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'purge-link-display' --> 'purge'
-- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'docpage-preload' --> 'Template:Documentation/preload'
خط ۵۱۶: خط ۵۱۶:
local preload = args.preload
local preload = args.preload
if not preload then
if not preload then
if subjectSpace == 6 then -- File namespace
if subjectSpace == 828 then -- Module namespace
preload = message('file-docpage-preload')
elseif subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
preload = message('module-preload')
else
else
خط ۶۳۲: خط ۶۳۰:
:tag('span')
:tag('span')
:addClass(data.headingClass)
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:cssText(data.headingStyleText)
:wikitext(data.heading)
:wikitext(data.heading)
خط ۶۵۶: خط ۶۵۵:
env = env or p.getEnvironment(args)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local docTitle = env.docTitle
local content = args.content or args['محتوا']
local content = args.content
if not content and docTitle and docTitle.exists then
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
خط ۶۷۰: خط ۶۶۹:
env = env or p.getEnvironment(args)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local docTitle = env.docTitle
if not (args.content or args['محتوا']) and docTitle and docTitle.exists then
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
return docTitle.prefixedText
else
else
خط ۷۲۵: خط ۷۲۴:
-- "Editors can experiment in this template's sandbox and testcases pages."
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not (args.content or args['محتوا']) and not args[1] then
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- Don't show this message with inline docs or with an explicitly specified doc page,
خط ۷۵۷: خط ۷۵۶:
-- 'history-link-display' --> 'history'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->  
-- 'transcluded-from-blurb' -->  
-- 'The above [[Wikipedia:Template documentation|documentation]]  
-- 'The above [[امامت‌پدیا:Template documentation|documentation]]  
-- is [[Help:Transclusion|transcluded]] from $1.'
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
-- 'You might want to $1 a documentation page for this [[امامت‌پدیا:Lua|Scribunto module]].'
--]=]
--]=]
local docTitle = env.docTitle
local docTitle = env.docTitle
خط ۹۴۴: خط ۹۴۳:
end
end
local subpagesLink = makeWikilink(
local subpagesLink = makeWikilink(
'ویژه:نمایه پیشوندی/' .. templateTitle.prefixedText .. '/',
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
message('subpages-link-display', {pagetype})
)
)
خط ۹۶۳: خط ۹۶۲:
-- 'doc-subpage' --> 'doc'
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
-- 'strange-usage-category' --> 'امامت‌پدیا pages with strange ((documentation)) usage'
--  
--  
-- /testcases pages in the module namespace are not categorised, as they may have
-- /testcases pages in the module namespace are not categorised, as they may have