Modul:Asbox: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Farras (bicara | kontrib)
k fix
perbaiki lokalisasi
 
(17 revisi perantara oleh 3 pengguna tidak ditampilkan)
Baris 1:
--[[
ModulThis inimodule dibuatwas olehcreated Penggunaby User:CodeHydro (Alexander Zhikun He).
User:Jackmcbarn and User:Mr._Stradivarius provided a great deal of assistance in writting p.main()
 
Baris 11:
Both templates had significant contributions from numerous others listed in the revision history tab of their respective pages.
--]]
local WRAPPER_TEMPLATE, args = 'TemplatTemplate:Asbox'
local templatestyles = 'Asbox/styles.css'
local p, Buffer, stubCats = {
--Prevents dupli-cats... get it? Maybe not?
Baris 22 ⟶ 23:
--initializes variables required by both p.main and p.templatepage
init = function(self, frame, page)
args, page = args or require('ModulModule:Arguments').getArgs(frame, {
wrappers = WRAPPER_TEMPLATE
}), page or mw.title.getCurrentTitle()
Baris 29 ⟶ 30:
return args, page
end
}, require('ModulModule:Buffer')
 
--[[
Baris 36 ⟶ 37:
or a table of strings and/or tables containing parts. (See below)
]]
local attention, catTag, catKey = Buffer'Pesan templateTemplat rintisan membutuhkanyang perlu perhatian', '[[Kategori:%s]]', '%s|%s%s'
local function category(cat)
for _, v in ipairs((tostring(cat) == cat or cat.t) and {cat} or cat) do
Baris 63 ⟶ 64:
local function ombox(v)
if v.ifNot then return end
p.ombox = p.ombox or require('ModulModule:Message box').ombox
category{v[2]}
return p.ombox{
Baris 108 ⟶ 109:
]]
table.insert(stubCats.v, v == '' and not p.demo and pageDoc.exists and
'Pesan templatetemplat rintisan dengan sub halamansubhalaman dokumentasi'
or not cat:match' stubs$' and {k = 'S', t = page.text}
)
Baris 119 ⟶ 120:
--One or more of the stub categories defined in this template do not seem to exist!
--Please double-check the parameters {{para|category}}, {{para|category1}} and {{para|category2}}.
'Parameter berikut'
'The following parameter'
.. (#stubCats.missing == 1 and ' definesmendefinisikan akategori stubrintisan category that doesyang' or 's define stubmendefinisikan categorieskategori thatrintisan doyang')
.. ' nottidak existada: ' .. mw.text.listToText(stubCats.missing),
{k = 'N', t = page.text}
}
Baris 128 ⟶ 129:
--Shows population of categories found by catStub(). Outputs demo values if none
local function population()
local wikitext, base = {}, '* [[:Kategori:%s]] (populationpopulasi: %s)\n'
if not args.category and stubCats[1] ~= false then
table.insert(stubCats, 1, false)
Baris 144 ⟶ 145:
function p.templatepage(frame, page)
args, page = p:init(frame, page)
local tStubDoc = mw.title.new'TemplatTemplate:Stub documentation'
local pageDoc = page:subPageTitle('doc')
--Reorganization note: Original Asbox alternates between outputting categories and checking on params |category#=.
Baris 151 ⟶ 152:
ombox{--Show ombox warnings for missing args.
ifNot = args.category,
'TheParameter <code>|category</code> parametertidak is not setditentukan. PleaseHarap addtambahkan ankategori appropriaterintisan stubyang categorysesuai.',
{k = 'C', t = page.text}
})
:_(ombox{
ifNot = args.subject or args.article or args.qualifier,
'TemplateTemplat rintisan ini belumtidak memuatberisi penjelasandeskripsi! Setidaknya satu parameterParameter <code>|subject</code>, <code>|article</code> oratau <code>|qualifier</code> harus diisididefinisikan semua atau salah satunya.',
{k = 'D', t = page.text}
})
Baris 162 ⟶ 163:
:_(category{
done = p.demo ~= 'doc',--Outputs categories if not doc demo
'Templat pesan rintisan',
'Exclude in print',
args.icon and
'Templat pesan rintisan yang menggunakan parameter ikon'
or args.image and (
mw.title.new('Media:' .. mw.text.split(args.image, '|')[1]).exists--do nothing if exists. category() will reject true
or {k = 'B', t = page.text}
)
or 'Templat pesan rintisan tanpa gambar',
args.imagealt and {k = 'I', t = page.text},
})
:_((not p.demo or p.demo == 'doc') and--Add standard stub template documentation
require('ModulModule:Documentation').main{
content = Buffer(page.text ~= 'Stub' and--This comparison performed in {{Asbox/stubtree}} before it invokes Module:Asbox stubtree
require('ModulModule:Asbox stubtree').subtree{args = {pagename = page.text}}
)
:_in'\n== AboutTentang thistemplat templateini ==\nThisnTemplat templateini isdigunakan useduntuk tomengidentifikasi identifyrintisan abertopik':_(args.subject):_'stub':_(args.qualifier):_out' '--space
:_'. ItTemplat usesini menggunakan {{[[TemplatTemplate:Asbox|asbox]]}}, which is asebuah meta-template designedtemplat toyang easedirancang theuntuk processmemudahkan ofproses creatingpembuatan anddan maintainingpemeliharaan stubtemplat templatesrintisan.\n=== UsagePenggunaan ===\nTypingnMengetik '
:_(mw.html.create'code'
:wikitext('{{', page.text == 'Stub' and 'stub' or page.text, '}}')
)
:_' menghasilkan pesan yang ditampilkan di bagian paling atas, dan menambahkan artikel ke kategor'
:_' produces the message shown at the beginning, and adds the article to the following categor'
:_(#stubCats > 1 and 'iesi' or 'yi')
:_':\n'
:_(population())
Baris 190 ⟶ 191:
frame:expandTemplate{title = pageDoc.text}
)
:_'\n== GeneralInformasi informationumum ==\n'
:_(frame:expandTemplate{title = tStubDoc.text})
:_'\n\n'(),
['link box'] = Buffer'ThisDokumentasi documentationini isdibuat automaticallysecara generatedotomatis bydengan [[Modul:Asbox]].'
:_in'TheInformasi generalumum informationditransklusikan is transcluded fromdari [[Templat:dokumentasi Stub documentation]]. '
:_(mw.html.create'span'
:cssText'font-size:smaller;font-style:normal;line-height:130%'
:node(('([%s editsunting] | [%s historyriwayat])'):format(
tStubDoc:fullUrl('action=edit', 'relative'),
tStubDoc:fullUrl('action=history', 'relative')
Baris 204 ⟶ 205:
:_out()
:_(page.protectionLevels.edit and page.protectionLevels.edit[1] == 'sysop' and
"ThisTemplat template isini [[WP:PROTECT|fullydiberi protectedperlindungan penuh]] and any, [[WP:CAT|categorieskategori]] shouldapa pun beharus addedditambahkan toke thesubhalaman template'stemplat ["
.. pageDoc:fullUrl('action=edit&preload=TemplatTemplate:Category_interwiki/preload', 'relative')
.. '| /doc] subpage, which isyang nottidak protecteddilindungi.'
)' <br/>'
}
Baris 214 ⟶ 215:
function p.main(frame, page)
args, page = p:init(frame, page)
local output = mw.html.create'tablediv'
:attr{role = 'note'}
:addClass'metadata plainlinks asbox stub'
:css{background = 'transparent'}
:tag'table'
:attr{role = 'presentation'}
:tag'tr'
:addClass'noresize'
:node((args.icon or args.image) and
mw.html.create'td'
:wikitext(args.icon or ('[[Berkas:%s|%spx|alt=%s]]'):format(
args.image or '',
args.pix or '40x30',
args.imagealt or 'StubIkon iconrintisan'
))
)
:tag'td'
:tag'i'
:wikitext(
Buffer'Artikel bertopik':_(args.subject):_(args.article or ''):_(args.qualifier)' ',--space
' ini adalah sebuah [[Wikipedia:Rintisan|rintisan]]. Anda dapat membantu Wikipedia dengan [',
page:fullUrl('action=edit', 'relative'),
' mengembangkannya].'
)
:done()
:node(args.name and
require'Modul:Navbar'._navbar{
args.name,
mini = 'yes',
style = 'position: absolute; right: 15px; display: none;'
}
)
:node(args.note and
mw.html.create()
:tag'br':done()
:tag'span'
:css{['font-style'] = 'normal', ['font-size'] = 'smaller'}
:wikitext(args.note)
:done()
)
:tag'td'
:tag'ip'
:addClass'asbox-body'
:wikitext(
Buffer'Artikel bertopik':_(args.subject):_(args.article or ''):_(args.qualifier)' ',--space
' ini adalah sebuah [[Wikipedia:Rintisan|rintisan]]. Anda dapat membantu Wikipedia dengan [',
page:fullUrl('action=edit', 'relative'),
' mengembangkannya].'
} )
:done()
:node(args.note and
mw.html.create()
:tag'spanp'
:addClass'asbox-note'
:wikitext(args.note)
:tag'br' :done()
)
:allDone()
:node(args.name and
require'ModulModule:Navbar'._navbar{
args.name,
mini = 'yes',
)}
)
--[[
Stub categories for templates include a sort key; (Otherwisethis ensures that all willstub betags indexedappear underat the letterbeginning 'T'of fortheir 'Template:[]respective stubs')categories.
Articles using the template do not need a sort key since they have unique names.
When p.demo equals 'doc', the demo stub categories will appear as those for a stub template.
Baris 269 ⟶ 271:
:node(output)
:tag'small':wikitext(
'DemoKategori categoriesdemo: ',
(category{done = true}:gsub('(%[%[)(Category:)([^|%]]-)(%|)', '%1%2%3|%2%3%4'):gsub('(%[%[)(Category:)', '%1:%2'))
):done()
Baris 282 ⟶ 284:
end
end
return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles} } .. tostring(output:wikitext(not p.demo and category{done = true} or nil))
end