Изменения

возможность переназначать значения параметров стиля при указанном стиле
Строка 60: Строка 60:  
local yesno = 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
 
local container = args._container or nil
 
local container = args._container or nil
 
local sep = args._sep and args._sep .. ' '
 
local sep = args._sep and args._sep .. ' '
Строка 74: Строка 74:  
style = nil
 
style = nil
 
end
 
end
   
-- передаётся шаблоном {{стопка примеров}}, один разделитель на все примеры
 
-- передаётся шаблоном {{стопка примеров}}, один разделитель на все примеры
 
local comment_sep = args._comment_sep or '  '
 
local comment_sep = args._comment_sep or '  '
   
-- полезно в шаблоне {{стопка примеров}} (это просто текст в конце)
 
-- полезно в шаблоне {{стопка примеров}} (это просто текст в конце)
 
local after = args._after or args._comment or ''
 
local after = args._after or args._comment or ''
   
-- полезно в шаблоне {{стопка примеров}} (это просто текст в начале)
 
-- полезно в шаблоне {{стопка примеров}} (это просто текст в начале)
 
local before = args._before and args._before .. ' ' or ''
 
local before = args._before and args._before .. ' ' or ''
 
 
 
if style == 'pre' then
 
if style == 'pre' then
tag = nil
+
if not (tag or container) then
container = 'pre'
+
container = 'pre'
sep = '\n'
+
end
 +
sep = sep or '\n'
 
elseif style == '*pre' then
 
elseif style == '*pre' then
tag = nil
+
if not (tag or container) then
container = '*pre'
+
container = '*pre'
sep = '\n'
+
end
 +
sep = sep or '\n'
 
elseif style == 'pre↓' then
 
elseif style == 'pre↓' then
tag = nil
+
if not (tag or container) then
container = 'pre'
+
container = 'pre'
+
end
 
-- содержимое шаблона {{sp↓|50%||-0.5em}}
 
-- содержимое шаблона {{sp↓|50%||-0.5em}}
sep = '<div style="margin:-0.5em 50% 0.7em;"><span style="font-size:150%;">↓</span></div>\n'
+
sep = sep or '<div style="margin:-0.5em 50% 0.7em;"><span style="font-size:150%;">↓</span></div>\n'
 
elseif style == '*pre↓' then
 
elseif style == '*pre↓' then
tag = nil
+
if not (tag or container) then
container = '*pre'
+
container = '*pre'
+
end
 
-- содержимое шаблона {{sp↓|50%||-0.5em}}
 
-- содержимое шаблона {{sp↓|50%||-0.5em}}
sep = '<div style="margin:-0.5em 50% 0.7em;"><span style="font-size:150%;">↓</span></div>\n'
+
sep = sep or '<div style="margin:-0.5em 50% 0.7em;"><span style="font-size:150%;">↓</span></div>\n'
 
elseif style == 'wikitable' then
 
elseif style == 'wikitable' then
tag = 'kbd'
+
if not (tag or container) then
 +
tag = 'kbd'
 +
end
 
sep = sep or '\n|'
 
sep = sep or '\n|'
comment_sep = '\n|'
+
comment_sep = comment_sep or '\n|'
 
end
 
end
 
 
 +
if not (tag or container) then
 +
tag = 'code'
 +
end
 
if not sep then
 
if not sep then
 
sep = '→ '
 
sep = '→ '
Анонимный участник