Modulo:Babel: Malsamoj inter versioj

[kontrolita revizio][kontrolita revizio]
Enhavo forigita Enhavo aldonita
e aldono el la modula provejo
aldono el la modula provejo
Linio 1:
-- Babel -- 2015070320150705
 
function subtitle(text)
Linio 222:
 
end -- babel_l2
 
function p._babel_l3(b,args)
-- this function builds the box used by the {{BabelLando}} template
local babels = {}
-- copies some named parameters from {{BabelLando}} into unnamed for the modul
local i = 1
for k, v in pairs(args) do
local x = args['l' .. i]
if type(x) == "string" then
x = mw.text.trim(x)
end
if x ~= "" then
babels[i] = x
i = i + 1
end
end
if args['common box'] == "yes" or args['komuna kesto'] =="jes" then
args.header = args.header or "[[Vikipedio:Babel]]"
args.footer = args.footer or "'''[[:Kategorio:Vikipediistoj laŭ lingvo]]'''"
args['extra-css'] = 'background-color:#FFFFFF;'
--shows it like the {{Babel}} template
return p._babel(babels,args)
else
-- shows it like the old {{BabelLando}}
local empty = {}
empty.header = args.header or "[[Vikipedio:Babel]]"
empty.footer = args.footer or "'''[[:Kategorio:Vikipediistoj laŭ lingvo]]'''"
empty['extra-css'] = 'background-color:#FFFFFF;'
empty.align = args.align
local align = "float-right" -- for the complete box
local align2 = "right" -- for the internal box
if empty.align == "left" then
align = "float-left"
align2 = "left"
end
-- creates the external table
local ret = mw.html.create('table')
:css('border','none')
:css('width','100px')
:addClass(align)
local row1 = ret:tag('tr')
local bab = row1:tag('td')
-- puts the babel information into the first table cell
local bab_cell = p._babel(babels, empty)
bab:wikitext(bab_cell)
:done()
local k = args.kat or 'jes'
local frame = mw.getCurrentFrame()
-- code for the template {{UzantoLando}}
if args.lando ~= nil and args.lando ~= "" then
-- creates the second table cell
local row2 = ret:tag('tr')
local der = row2:tag('td')
local l1 = args.lando
local l2 = args.loko or ""
local l3 = args.lokospeco or ""
local n = args.nomo or "{{PAGENAME}}"
der:wikitext( frame:preprocess('{{UzantoLando|lando='
.. l1 .. '|loko=' .. l2 .. '|lokospeco=' .. l3 .. '|nomo='
.. n .. '|kat=' .. k .. '|babel-larĝo=jes|floso=' .. align2 .. '}}') )
:done()
end
return tostring(ret)
end
 
end -- babel_l3
 
function p._babel(babels, args)
Linio 489 ⟶ 558:
end
local funcNames = {'babel', 'babel_x', 'babel_l', 'babel_l2', 'babel_l3'}
for _, funcName in ipairs(funcNames) do