Модуль:Loc/Marking: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показана 1 промежуточная версия этого же участника) | |||
| Строка 19: | Строка 19: | ||
local defaultSize = 100 | local defaultSize = 100 | ||
local size = math.ceil(defaultSize * 2 / math.sqrt(level)) | local size = math.ceil(defaultSize * 2 / math.sqrt(level)) | ||
return '< | 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 | ||
| Строка 141: | Строка 141: | ||
end | end | ||
local function transform(s) | local function transform(s, noFormat) | ||
s = s or "" | s = s or "" | ||
s = mw.ustring.gsub(s, "%[tooltip([^%]]*)%]", function(raw_attrs) | s = mw.ustring.gsub(s, "%[tooltip([^%]]*)%]", function(raw_attrs) | ||
| Строка 155: | Строка 155: | ||
return "{{altTooltip|1=" .. (visible or "") .. "|2=<span style='white-space:pre-wrap;'>{{#invoke:Loc|GetRawString|noFormat=1|" .. (tip or "") .. "}}</span>}}" | 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 | ||
local c_s, c_e, c_tag = mw.ustring.find(s, "%[/([%w_]+)%]") | local c_s, c_e, c_tag = mw.ustring.find(s, "%[/([%w_]+)%]") | ||
| Строка 176: | Строка 177: | ||
end | end | ||
end | end | ||
s = mw.ustring.gsub(s, "%[/?[%w_]+[^%]]*%]", "") | s = mw.ustring.gsub(s, "%[/?[%w_]+[^%]]*%]", "") | ||
s = convert_lists(s) | |||
if not noFormat then | |||
s = convert_lists(s) | |||
end | |||
return s | return s | ||
end | end | ||
| Строка 203: | Строка 209: | ||
local class = noFormat and "ts-loc-format" or "" | local class = noFormat and "ts-loc-format" or "" | ||
local content = transform(text) | local content = transform(text, noFormat) | ||
if mw.ustring.find(content, '^[ \t]*[#%*;%:]+') then | if mw.ustring.find(content, '^[ \t]*[#%*;%:]+') then | ||
content = '\n' .. content | content = '\n' .. content | ||