Content deleted Content added
Andreyyshore (talk | contribs) No edit summary |
Andreyyshore (talk | contribs) mNo edit summary |
||
(13 intermediate revisions by the same user not shown) | |||
Line 1:
local p = {}
function p.stack(str, vertAlign, noBold)
local t = {}
local breakPattern = "<[bB][rR] */? *>"
Line 8:
return ""
end
local text = mw.ustring.toNFC(str):gsub("%[%[([^%[%]%|]+)%|([^%[%]%|]+)%]%]", function(a, b)
splitLines((str:gsub("(.-)(" .. breakPattern .. ")", splitLines)))▼
return "[[" .. a .. "|" .. b:gsub(breakPattern, "]]<br>[[" .. a .. "|") .. "]]"
end)▼
for k, v in pairs(t) do
t[k] = (
mw.ustring.gsub(
:gsub("([^'%[%]])", "%1<br>")▼
)
:gsub("(''+)<br>", "%1")
:gsub("(%[%[+)<br>", "%1")
Line 30 ⟶ 35:
)
end
if #t == 1 then return t[1] end
▲ end
local dom1 = mw.html.create("tr")
if noBold ~= "" then dom1:css("font-weight", "normal") end
local dom2
for _, v in pairs(t) do
Line 42 ⟶ 46:
["border"] = "none",
["padding"] = 0,
["vertical-align"] = vertAlign,
["width"] = "1em",
["max-width"] = "1em"
})
:wikitext(v)
Line 65 ⟶ 71:
local maxWidth = frame.args.maxWidth
local noBold = frame.args.noBold
local style = frame.args.style:gsub("\"", """)
local cellStyle = frame.args.cellstyle:gsub("\"", """)
local wikiText = "class = \"nowrap"
local normalAlign = ""
Line 85 ⟶ 92:
wikiText = wikiText .. " unsortable"
end
wikiText = wikiText .. "\" style=\"line-height
if stack == "" then
wikiText = wikiText .. "99"
else
wikiText = wikiText .. "120"
end
wikiText = wikiText .. "%;vertical-align:" .. vertAlign .. ";padding:"
if sortPadding == "" then
wikiText = wikiText .. ".4em"
Line 92 ⟶ 104:
wikiText = wikiText .. "21px"
end
if (stack ~= "" and text:find(breakPattern) ~= nil) then
wikiText = wikiText .. " .4em .2em;background-position:50% .4em !important;"▼
wikiText = wikiText .. " .2em"
else
wikiText = wikiText .. " .4em"
end
if stack == "" then
wikiText = wikiText .. "min-width:" .. width .. ";max-width:" .. width ..
";width:" .. width .. ";overflow:hidden;" .. cellStyle .. "\""
end
wikiText = wikiText .. " | <div style=\""
if stack == "" then
wikiText = wikiText .. frame:preprocess("{{writing-mode|v1}}{{Transform-rotate|180}}") ..
"-ms-transform: none \ ;padding-left:1px;
if vertAlign == "top" then
normalAlign = "right"
Line 113 ⟶ 130:
else normalAlign = "center"
end
wikiText = wikiText .. "text-align:" .. normalAlign .. ";" -- text-align:" .. stupidIEAlign .. " \ ;"
wikiText = wikiText .. style .. "\">"
local textToAdd = text
if stack ~= "" then
textToAdd = p.stack(text, vertAlign, noBold)
end
if noBold == "" then
|