Mô đun:Babel

local p = {}

local getArgs

local function showUserbox(frame, v, nocat)
	local maybeNocat = ''
	if nocat then
		maybeNocat = '|nocat=yes'
	end
	return frame:preprocess('{{User '..v..maybeNocat..'}}')
end

function p.main(frame)
	if not getArgs then
		getArgs = require('Module:Arguments').getArgs
	end
	local args = getArgs(frame, {wrappers = 'Bản mẫu:Babel'})

	local ret = mw.html.create('table')
				:addClass('userboxes')
				:css( {
						float = args.align or 'right',
						['margin-left'] = (args.left or '1') .. 'em',
						['margin-bottom'] = (args.bottom or '0') .. 'em',
						width = (args.width or '248') .. 'px',
						clear = args.align or 'right',
						color = args.textcolor or '#000000',
						border = (args.bordercolor or '#99B3FF') .. ' solid ' .. (args.solid or 1)..'px'
					} )

	local nocat = args.nocat and string.lower(args.nocat) == 'yes'

	if args.shadow and string.lower(args.shadow) == 'yes' then
		ret:css({ ['box-shadow'] = '0 2px 4px rgb(0,0,0,0.2)',
						['-mox-box-shadow'] = '0 2px 4px rgb(0,0,0,0.2)',
						['-webkit-box-shadow'] = '0 2px 4px rgb(0,0,0,0.2)' })
	end

	ret:cssText( args['extra-css'] or '' )

	local color = args.color or 'inherit'
	local row1 = ret:tag('tr')
	local row2 = ret:tag('tr')
	local row3 = ret:tag('tr')

	local body_cells = row2:tag('td')
				:css('vertical-align', 'middle !important')

	local userboxes
	-- Special message for when first argument is blank; otherwise treat it as normal
	if args[1] and args[1]:find('%S') then
		userboxes = showUserbox(frame, args[1], nocat)
	else
		userboxes = args.noboxestext or "''Thành viên này không biết đọc hay viết bằng bất kỳ ngôn ngữ nào. Xin vui lòng xem [[bản mẫu:Babel/doc]] để được trợ giúp.''"
	end

	body_cells:wikitext(userboxes)

	-- "remove" args[1] so it isn't looked at in the loop
	-- table.remove(args,1) doesn't produce desired result
	args[1] = ''

	-- Keep track of how many columns are in this table
	local col_span = 1
	for _, v in ipairs( args ) do
		-- ! indicates a new cell should be created
		if v:find('%S') and v ~= '!' then
			body_cells:wikitext( showUserbox(frame, v, nocat) )
		-- Recycling body_cells for <td>
		elseif v and v == '!' then
			col_span = col_span + 1
			body_cells:done()
			body_cells = row2:tag('td')
		end
	end

	row1:tag('th')
			:css({ ['background-color'] = color,
					['text-align'] = 'center' })
			:attr('colspan',col_span)
			:wikitext( args.header or '[[Wikipedia:Ngôn ngữ sử dụng|Wikipedia:Babel]]' )
			:done()

	row3:tag('td')
			:css({ ['background-color'] = color,
					['text-align'] = 'center' })
			:attr('colspan',col_span)
			:wikitext( args.footer or '[[:Thể loại:Thành viên theo ngôn ngữ|Tìm kiếm thành viên theo ngôn ngữ]]' )
			:done()

	if args['special-boxes'] then
		body_cells:wikitext(args['special-boxes'])
	end

	body_cells:done()

	return tostring(ret)
end

return p
Chúng tôi bán
Bài viết liên quan
Mondstadt và Đại thảm họa Thủy Triều Đen
Mondstadt và Đại thảm họa Thủy Triều Đen
Bối cảnh rơi vào khoảng thời gian khoảng 500 năm sau cuộc khởi nghĩa nhân dân cuối cùng ở Mondstadt kết thúc, Venessa thành lập Đội Kỵ Sĩ Tây Phong để bảo vệ an toàn và duy trì luật pháp cho đất nước
Tìm hiểu về Chainsaw Man anime trước khi xem
Tìm hiểu về Chainsaw Man anime trước khi xem
Câu chuyện lấy bối cảnh ở một thế giới giả tưởng nơi tồn tại những con quái vật được gọi là ác quỷ, và thế giới này đang phải chịu sự tàn phá của chúng.
Nhân vật Delta -  The Eminence In Shadow
Nhân vật Delta - The Eminence In Shadow
Delta (デルタ, Deruta?) (Δέλτα), trước đây gọi là Sarah (サラ, Sara?), là thành viên thứ tư của Shadow Garden
Một vài thông tin về Joy Boy  - One Piece
Một vài thông tin về Joy Boy - One Piece
Ông chính là người đã để lại một báu vật tại hòn đảo cuối cùng của Grand Line, sau này báu vật ấy được gọi là One Piece, và hòn đảo đó được Roger đặt tên Laugh Tale