Modul:Asbox: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
k fix |
Hidayatsrf (bicara | kontrib) perbaiki lokalisasi |
||
(17 revisi perantara oleh 3 pengguna tidak ditampilkan) | |||
Baris 1:
--[[
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 = '
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('
wrappers = WRAPPER_TEMPLATE
}), page or mw.title.getCurrentTitle()
Baris 29 ⟶ 30:
return args, page
end
}, require('
--[[
Baris 36 ⟶ 37:
or a table of strings and/or tables containing parts. (See below)
]]
local attention, catTag, catKey = Buffer'
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('
category{v[2]}
return p.ombox{
Baris 108 ⟶ 109:
]]
table.insert(stubCats.v, v == '' and not p.demo and pageDoc.exists and
'Pesan
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'
.. (#stubCats.missing == 1 and '
.. '
{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]] (
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'
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,
'
{k = 'C', t = page.text}
})
:_(ombox{
ifNot = args.subject or args.article or args.qualifier,
'
{k = 'D', t = page.text}
})
Baris 162 ⟶ 163:
:_(category{
done = p.demo ~= 'doc',--Outputs categories if not doc demo
'Templat
'Exclude in print',
args.icon and
'Templat
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
args.imagealt and {k = 'I', t = page.text},
})
:_((not p.demo or p.demo == 'doc') and--Add standard stub template documentation
require('
content = Buffer(page.text ~= 'Stub' and--This comparison performed in {{Asbox/stubtree}} before it invokes Module:Asbox stubtree
require('
)
:_in'\n==
:_'.
:_(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'
:_(#stubCats > 1 and '
:_':\n'
:_(population())
Baris 190 ⟶ 191:
frame:expandTemplate{title = pageDoc.text}
)
:_'\n==
:_(frame:expandTemplate{title = tStubDoc.text})
:_'\n\n'(),
['link box'] = Buffer'
:_in'
:_(mw.html.create'span'
:cssText'font-size:smaller;font-style:normal;line-height:130%'
:node(('([%s
tStubDoc:fullUrl('action=edit', 'relative'),
tStubDoc:fullUrl('action=history', 'relative')
Baris 204 ⟶ 205:
:_out()
:_(page.protectionLevels.edit and page.protectionLevels.edit[1] == 'sysop' and
"
.. pageDoc:fullUrl('action=edit&preload=
.. '| /doc]
)' <br/>'
}
Baris 214 ⟶ 215:
function p.main(frame, page)
args, page = p:init(frame, page)
local output = mw.html.create'
:attr{role = 'note'}
:addClass'metadata plainlinks asbox stub'
: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 '
))
)▼
: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',▼
}▼
)▼
:node(args.note and▼
mw.html.create()▼
:tag'br':done()▼
:tag'span'▼
:wikitext(args.note)▼
)
▲ :tag'td'
: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()
:addClass'asbox-note'
▲ :wikitext(args.note)
▲ )
:allDone()
▲ )
--[[
Stub categories for templates include a sort key;
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(
'
(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
|