Изменения
Перейти к навигации
Перейти к поиску
Строка 39:
Строка 39:
− local prefix = args.prefix or args._prefix or args['pre-text'] or args['_pre-text'] or ''
− local postfix = args.postfix or args._postfix or args['post-text'] or args['_post-text'] or ''
Строка 52:
Строка 50:
− +
Строка 64:
Строка 62:
+
− targs = mw.text.split(v, '\\') +
− else+
− targs = {}+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
− +
− +
обработка параметров для каждого отдельного примера
local nocat = args.nocat or args._nocat
local nocat = args.nocat or args._nocat
local spaced = args.spaced or args._spaced
local spaced = args.spaced or args._spaced
local comment_sep = args.comment_sep or args._comment_sep
local comment_sep = args.comment_sep or args._comment_sep
local inthemiddle = yesno(args.inthemiddle or args._inthemiddle, false)
local inthemiddle = yesno(args.inthemiddle or args._inthemiddle, false)
end
end
local targs, content = {}, ''
local content = ''
if style == 'wikitable' then
if style == 'wikitable' then
if not inthemiddle then
if not inthemiddle then
end
end
for k, v in pairs(args) do
for k, v in pairs(args) do
local pre_targs, targs = {}, {}
if type(k) == 'number' then
if type(k) == 'number' then
if v ~= '' then
if v ~= '' then
pre_targs = mw.text.split(v, '\\')
for k2, v2 in pairs(pre_targs) do
equals_pos = nil
if v2:sub(1, 1) == '_' and v2:find('=') then --параметры настроек шаблона "пример"
equals_pos = v2:find('=')
end
if equals_pos then
param = v2:sub(1, equals_pos-1)
value = v2:sub(equals_pos+1)
targs[param] = value
else
if v2:sub(1, 5) == '_' then
targs[k2] = v2:gsub('_', '_')
else
targs[k2] = v2
end
end
end
end
end
table.insert(targs, 1, tname)
table.insert(targs, 1, tname)
targs._sep, targs._style, targs._nobr, targs._nocat, targs._spaced, targs['_prefix'], targs['_postfix'], targs._comment_sep
targs._sep, targs._style, targs._nobr, targs._nocat, targs._spaced, targs._comment_sep
= sep, style, nobr, nocat, spaced, prefix, postfix, comment_sep
= sep, style, nobr, nocat, spaced, comment_sep
content = content .. opener .. tostring(expand(frame, 'пример', targs)) .. '\n'
content = content .. opener .. tostring(expand(frame, 'пример', targs)) .. '\n'
end
end