Модуль:Loc/Marking: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показано 7 промежуточных версий этого же участника) | |||
| Строка 16: | Строка 16: | ||
elseif t == "head" then | elseif t == "head" then | ||
local level = params and tonumber(params._value) or 1 | local level = params and tonumber(params._value) or 1 | ||
return '< | level = math.max(1, math.min(3, level)) | ||
local defaultSize = 100 | |||
local size = math.ceil(defaultSize * 2 / math.sqrt(level)) | |||
return '<span style="font-weight:bold; font-size:' .. size .. '%;">' .. inner .. '</span>' | |||
elseif t == "font" then | elseif t == "font" then | ||
local family = params and params._value or nil | local family = params and params._value or nil | ||
| Строка 150: | Строка 153: | ||
if tip == "" and params._value and visible ~= params._value then tip = params._value end | if tip == "" and params._value and visible ~= params._value then tip = params._value end | ||
end | end | ||
return "{{altTooltip|1=" .. (visible or "") .. "|2={{#invoke:Loc|GetRawString|" .. (tip or "") .. "}}}}" | return "{{altTooltip|1=" .. (visible or "") .. "|2=<span style='white-space:pre-wrap;'>{{#invoke:Loc|GetRawString|noFormat=1|" .. (tip or "") .. "}}</span>}}" | ||
end) | end) | ||
while true do | while true do | ||
| Строка 194: | Строка 197: | ||
local args = frame.args or {} | local args = frame.args or {} | ||
local text = args[1] or args.text or "" | local text = args[1] or args.text or "" | ||
local | local noFormat = args.noFormat | ||
text = mw.text.unstripNoWiki(text) | text = mw.text.unstripNoWiki(text) | ||
text = process_nowiki_equals(text) | text = process_nowiki_equals(text) | ||
local class = | local class = noFormat and "ts-loc-format" or "" | ||
local content = transform(text) | local content = transform(text) | ||
if mw.ustring.find(content, '^[ \t]*[#%*;%:]+') then | if mw.ustring.find(content, '^[ \t]*[#%*;%:]+') then | ||
| Строка 211: | Строка 214: | ||
{ src = 'Модуль:Loc/styles.css' } | { src = 'Модуль:Loc/styles.css' } | ||
) .. | ) .. | ||
'< | '<span class="list-reset-margin ' .. class .. '">' .. content .. '</span>' | ||
) | ) | ||
end | end | ||
return p | return p | ||