Modul:Vikipediya

Vikilug‘atdan olingan

Ushbu modul' {{Vikipediya}} fojdalanadi sylki tugʻilish uchun Oʻzbekcha Vikipediya. testirovaniya uchun, ushbu modul' jumas talab jutilgan fojdalanish, ushbuning fojdalanish {{Vikipediya}}.

Katta khuhhatlarning khakida jung andoza Andoza:Vikipediya.


-- Bu yerda sizning tajriba Scribunto moduli kod qoʻshing.
-- Organ sinov uchun, koʻrsatiladigan munozarasi sahifa foydalaning.

-- Oʻzbekcha Vikipediya bogʻlovchi moduli
local p = {}

-- O'zbekcha Vikipediya bog'lovchi moduli
local function generateLinks( frame )
	local tili = mw.language.getContentLanguage()
	local title = mw.title.getCurrentTitle()
	local output = ''
	local junk = ''
	local wordlist = {}
	for key, value in pairs( frame.args ) do
		if ( value == '' ) then
			-- Eslatma: Ushbu qiymati barcha ishlatilgan emas, faqat bir so'yish davom ettirish uchun
            -- (Lua bir "davom" vazifasini yo'q)
			junk = value
		else
			value = tili:ucfirst( value )
			table.insert( wordlist, '[[w:' .. value .. '|' .. value .. ']]' )
		end
	end

	local noofwords = table.maxn( wordlist )
	if ( noofwords == 0 ) then
		local word = tili:ucfirst( title.text )
		output = '[[w:' .. word .. '|' .. word .. ']]'
	elseif ( noofwords == 1 ) then
		output = wordlist[1]
	else
		output = table.concat( wordlist, ', ', 1, noofwords - 1 ) .. ' and ' .. wordlist[noofwords]
	end
	return output
end

-- Asosiy vazifasi moduli ishlatish uchun
function p.run( frame )
	local output = ''
	local links = generateLinks( frame )

	output = frame:expandTemplate {
		title = 'sisterproject',
		args = {
			project = 'Vikipediya',
			image = 'Wikipedia-logo-simple.png|link=w:Main Page',
			text = '[[w:Main Page|Oʻzbekcha Vikipediya]] maqola ustida bor:',
			link = links
		}
	}

	return frame:preprocess( output )
end

return p