Изменения
параметр spaced для отбивки каждого параметра пробелом в шаблонах типа t:книга
getArgs = require('Module:Arguments').getArgs
getArgs = require('Module:Arguments').getArgs
end
end
local yesorno = require('Module:Yesno')
local yesno = require('Module:Yesno')
local args = copy(getArgs(frame, {trim = false, removeBlanks = false})) --copy(frame.args)
local args = copy(getArgs(frame, {trim = false, removeBlanks = false})) --copy(frame.args)
local tag = args._tag or 'code'
local tag = args._tag or 'code'
local container = args._container or nil
local container = args._container or nil
local sep = args._sep and args._sep .. ' ' or '→ ' -- по умолчанию "→"
local sep = args._sep and args._sep .. ' ' or '→ ' -- по умолчанию "→"
local link = yesorno(args._link, false)
local link = yesno(args._link, false)
local endl = args._endl or ''
local endl = args._endl or ''
local pre_text = args['_pre-text'] or args._prefix or ''
local pre_text = args['_pre-text'] or args._prefix or ''
local post_text = args['_post-text'] or args._postfix or ''
local post_text = args['_post-text'] or args._postfix or ''
local nobr = yesorno(args._nobr, false)
local nobr = yesno(args._nobr, false)
local nocat = yesorno(args._nocat, false)
local spaced = yesno(args._spaced, false)
local style = args._style or ''
local nocat = yesno(args._nocat, false)
local style = args._style
if style == 'pre' then
if style == 'pre' then
tag = nil
tag = nil
container = 'pre'
container = 'pre'
sep = '<div style="margin-left: 50%; margin-bottom: 0.7em;"><big>↓</big></div>\n' --содержимое шаблона t:sp↓
sep = '<div style="margin-left: 50%; margin-bottom: 1em;"><big>↓</big></div>\n' --слегка изменённое содержимое шаблона t:sp↓
elseif style == '*pre↓' then
elseif style == '*pre↓' then
tag = nil
tag = nil
container = '*pre'
container = '*pre'
sep = '<div style="margin-left: 50%; margin-bottom: 0.7em;"><big>↓</big></div>\n' --содержимое шаблона t:sp↓
sep = '<div style="margin-left: 50%; margin-bottom: 1em;"><big>↓</big></div>\n' --слегка изменённое содержимое шаблона t:sp↓
elseif style == 'wikitable' then
elseif style == 'wikitable' then
tag = 'tt'
tag = 'tt'
end
end
content = content .. endl
content = content .. endl
local targs, equals_pos, param, value, left_shift = {}, 0, '', '', 0
local targs, equals_pos, param, value, left_shift, i = {}, 0, '', '', 0, 0
for k, v in pairs(args) do
for k, v in pairs(args) do
if type(k) == 'number' then --неименованные параметры
if type(k) == 'number' then --неименованные параметры
if spaced then i = i+1 end
equals_pos = v:find('=')
equals_pos = v:find('=')
if equals_pos and v:find('{{=}}') == equals_pos-2 then
if equals_pos and v:find('{{=}}') == equals_pos-2 then
value = v:sub(equals_pos+1)
value = v:sub(equals_pos+1)
targs[param] = process_nowiki_equals(value)
targs[param] = process_nowiki_equals(value)
content = content .. '|' .. nowiki(param) .. '=' .. nowiki(value) .. endl
content = content .. (spaced and i == 1 and ' ' or '') .. '|' .. nowiki(param) .. '=' .. nowiki(value) .. (spaced and ' ' or '') .. endl
left_shift = left_shift+1 --переменная нужна, чтобы квазинумерованные параметры, переданные
left_shift = left_shift+1 --переменная нужна, чтобы квазинумерованные параметры, переданные
else --через "{{=}}", не сбивали порядок
else --через "{{=}}", не сбивали порядок
end
end
elseif not k:find('^_') then --именованные параметры, исключая модификаторы внешнего вида
elseif not k:find('^_') then --именованные параметры, исключая модификаторы внешнего вида
if spaced then i = i+1 end
targs[k] = process_nowiki_equals(v)
targs[k] = process_nowiki_equals(v)
content = content .. '|' .. k .. '=' .. nowiki(v) .. endl
content = content .. (spaced and i == 1 and ' ' or '') .. '|' .. k .. '=' .. nowiki(v) .. (spaced and ' ' or '') .. endl
end
end
end
end