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

۴۶۴ بایت اضافه‌شده ،  ‏۱۴ سپتامبر ۲۰۲۱
جز
خنثی‌سازی ویرایش 33110324 از Jeeputer (بحث)
جز (۱ نسخه واردشده)
جز (خنثی‌سازی ویرایش 33110324 از Jeeputer (بحث))
خط ۳: خط ۳:
User:Jackmcbarn and User:Mr._Stradivarius provided a great deal of assistance in writting p.main()
User:Jackmcbarn and User:Mr._Stradivarius provided a great deal of assistance in writting p.main()


p.main() draw heavily from the following version of Template:Asbox of the English Wikipedia, authored primarily by User:Rich_Farmbrough
p.main() draw heavily from the following version of Template:Asbox of the English imamatpedia, authored primarily by User:Rich_Farmbrough
https://en.wikipedia.org/w/index.php?title=Template:Asbox&oldid=619510287
https://en.imamatpedia.org/w/index.php?title=Template:Asbox&oldid=619510287


p.templatepage() is derived from the following revision of Template:Asbox/templatepage, authored primarily by User:MSGJ
p.templatepage() is derived from the following revision of Template:Asbox/templatepage, authored primarily by User:MSGJ
https://en.wikipedia.org/w/index.php?title=Template:Asbox/templatepage&oldid=632914791
https://en.imamatpedia.org/w/index.php?title=Template:Asbox/templatepage&oldid=632914791


Both templates had significant contributions from numerous others listed in the revision history tab of their respective pages.
Both templates had significant contributions from numerous others listed in the revision history tab of their respective pages.
خط ۱۳: خط ۱۳:
local WRAPPER_TEMPLATE, args = 'الگو:الگوی_خرد'
local WRAPPER_TEMPLATE, args = 'الگو:الگوی_خرد'
local templatestyles = 'الگوی_خرد/styles.css'
local templatestyles = 'الگوی_خرد/styles.css'
local num_con = require('Module:Numeral converter').convert -- convert numbers to Persian
local p, Buffer, stubCats = {
local p, Buffer, stubCats = {
--Prevents dupli-cats... get it? Maybe not?
--Prevents dupli-cats... get it? Maybe not?
خط ۷۸: خط ۷۹:
local function catStub(page, pageDoc)
local function catStub(page, pageDoc)
stubCats = {missing = {}, v = {}}
stubCats = {missing = {}, v = {}}
-- zwj and zwnj have semantical use in other other wikis, don't remove them
local zwj = '\226\128\141'  -- U+200D, E2 80 8D
local zwnj = '\226\128\140' -- U+200C, E2 80 8C
disallowedUnicodeChars = '[^%w%p%s' .. zwj .. zwnj .. ']' -- for i18n we make this a separate string
local code
local code
for k, _ in pairs(args) do
for k, _ in pairs(args) do
--Find category parameters and store the number (main cat = '')
--Find category parameters and store the number (main cat = '')
table.insert(stubCats, string.match(k, '^رده(%d*)$'))
table.insert(stubCats, string.match(k, '^رده(%d*)$'))
table.insert(stubCats, string.match(k, '^category(%d*)$'))
end
end
table.sort(stubCats)
table.sort(stubCats)
for k, v in ipairs(stubCats) do
for k, v in ipairs(stubCats) do
--Get category names and, if called by p.templatepage, the optional sort key
--Get category names and, if called by p.templatepage, the optional sort key
local tsort, cat = args['tempsort' .. v], mw.ustring.gsub(args['category' .. v], '[^%w%p%s‌]', '')--remove all hidden unicode chars  
local tsort, cat = args['tempsort' .. v], mw.ustring.gsub(args['category' .. v], disallowedUnicodeChars, '')--remove all hidden unicode chars  
--Do not place template in main category if |tempsort = 'no'. However, DO place articles of that template in the main category.
--Do not place template in main category if |tempsort = 'no'. However, DO place articles of that template in the main category.
table.insert(stubCats.v,
table.insert(stubCats.v,
خط ۱۳۶: خط ۱۴۲:
table.insert(wikitext, base:format(
table.insert(wikitext, base:format(
v and args['category' .. v] or '{{{category}}}',
v and args['category' .. v] or '{{{category}}}',
v and mw.site.stats.pagesInCategory(args['category' .. v], 'all') or 0
v and num_con("fa", mw.site.stats.pagesInCategory(args['category' .. v], 'all')) or "۰"
))
))
end
end
خط ۲۵۰: خط ۲۵۶:
:addClass'asbox-body'
:addClass'asbox-body'
:wikitext(
:wikitext(
Buffer'این یک [[ویکی‌پدیا:خرد|مقالهٔ خرد]] ':_(args.subject):_(args.qualifier)' ',--space
Buffer'این یک [[امامت‌پدیا:خرد|مقالهٔ خرد]] ':_(args.subject):_(args.qualifier)' ',--space
' است. می‌توانید با [',
' است. می‌توانید با [',
page:fullUrl('action=edit', 'relative'),
page:fullUrl('action=edit', 'relative'),
' گسترش آن] به ویکی‌پدیا کمک کنید.'
' گسترش آن] به امامت‌پدیا کمک کنید.'
)
)
:done()
:done()
کاربر ناشناس