"Module:Kartoçka" səhifəsinin versiyaları arasındakı fərqlər
Jump to navigation
Jump to search
(Səhifəni 'local p = {}; local yesno = require('Module:Yesno') local function _renderLine( frame, args, i ) if args[ 'başlıq' .. i ] and args[ 'başlıq' .. i ] == '-' then re...' ilə yarat) |
(Fərqli deyil)
|
Səhifəsinin 06:25, 17 iyun 2020 tarixinə olan son halı
Bu modulun təlimatı üçün bu səhifə yaradıla bilər: Module:Kartoçka/doc
local p = {}; local yesno = require('Module:Yesno') local function _renderLine( frame, args, i ) if args[ 'başlıq' .. i ] and args[ 'başlıq' .. i ] == '-' then return '' elseif args[ 'başlıq' .. i ] and args[ 'başlıq' .. i ] ~= '' then local style = ( args[ 'başlıqlar stili' ] or '' ) .. ( args[ 'başlıq stili' .. i ] or '' ); local class = ( args[ 'sinif' .. i ] or '' ); return '\n<tr>\n<th colspan="2" class="infobox-header ' .. class .. '" style="' .. style .. '">' .. args[ 'başlıq' .. i ] .. '</th>\n</tr>'; end local text = args[ 'mətn' .. i ] or ''; if args[ 'vikiverilənlər' .. i ] and args[ 'vikiverilənlər' .. i ] ~= '' then text = frame:expandTemplate{ title = 'Wikidata', args = { args[ 'vikiverilənlər' .. i ], text, from = args[ 'from' ] or '' } }; end if text ~= '' then local label = args[ 'nişan' .. i ] or ''; local class = args[ 'sinif' .. i ] or ''; if string.find(class, 'noplainlist') == nil then class = class .. ' plainlist'; end if class ~= '' then class = ' class="' .. class .. '"'; end local style = ( args[ 'mətnlərin stili' ] or '' ) .. ( args[ 'mətnin stili' ] or '' ) .. ( args[ 'mətnin stili' .. i ] or '' ); if label == '' then style = 'text-align:center;' .. style; end if style ~= '' then style = ' style="' .. style .. '"'; end if label ~= '' then local labelClass = args[ 'nişan sinfi' ] or ''; if string.find(labelClass, 'noplainlist') == nil then labelClass = labelClass .. ' plainlist'; end if labelClass ~= '' then labelClass = ' class="' .. labelClass .. '"'; end local labelStyle = ( args[ 'nişan stili' ] or '' ) .. ( args[ 'nişanlar stili' .. i ] or '' ); if labelStyle ~= '' then labelStyle = ' style="' .. labelStyle .. '"'; end return '\n<tr>\n<th' .. labelClass .. labelStyle .. '>' .. label .. '</th>' .. '\n<td' .. class .. style .. '>\n' .. text .. '</td>\n</tr>'; end return '\n<tr>\n<td colspan="2"' .. class .. style .. '>\n' .. text .. '</td>\n</tr>'; end return ''; end local function maxNumber ( args ) local maxNumber = 0 for argName, _ in pairs(args) do local argNumber = mw.ustring.match(argName, '^[^0-9]+([0-9]+)$') if argNumber and tonumber(argNumber) > maxNumber then maxNumber = tonumber(argNumber) end end return maxNumber end function p.renderLine( frame ) local args = frame:getParent().args; return _renderLine(frame, args, '') end function p.renderLines( frame ) local args = frame:getParent().args; local res = '' local header, text = '', '' local autoHeaders = yesno(args [ 'avtobaşlıqlar' ] or 'false', false) for i = 1, maxNumber(args) do if args[ 'başlıq' .. i ] and args[ 'başlıq' .. i ] ~= '' then if text ~= '' or not autoHeaders then res = res .. header .. text end header, text = _renderLine(frame, args, i), '' else text = text .. _renderLine(frame, args, i) end end if text ~= '' or not autoHeaders then res = res .. header .. text end return res end return p;