Module:Sandbox/Andreyyshore/Vertical header: Difference between revisions

Content deleted Content added
No edit summary
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
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)
splitLines(strtext:gsub("(.-)(" .. breakPattern .. ")", splitLines))
for k, v in pairs(t) do
t[k] = (
mw.ustring.gsub(
mw.ustring.gsub(v, "([^'%[%]])", "%1<br>"),
"<br>'(%[^']+)", "%1'<br>%1")
mw.ustring.gsub(
)
mw.ustring.gsub(
mw.ustring.:gsub(v, "([^'%[%]]'+)<br>", "%1<br>"),
:gsub("'(%[%[^']+)<br>", "'<br>%1"),
":gsub(''+)"<br>(%]+)", "%1<br>"),
"(%[%[+)<br>", "%1"),
"<br>(%]+)", "%1<br>")
:gsub("%[%[([^%[%]]+)%]%]", function(n)
local inBrackets = n
Line 26 ⟶ 27:
inBrackets = inBrackets:gsub("<br>", "") .. "|" .. inBrackets
else
stripped = mw.ustring.gsub(mw.ustring.inBrackets:match(inBrackets, "^[^%|]+%|"), :gsub("<br>", "")
inBrackets = stripped .. mw.ustring.inBrackets:gsub(inBrackets, "^[^%|]+%|<br>", "")
end
return "[[" .. inBrackets .. "]]"
Line 45 ⟶ 46:
["border"] = "none",
["padding"] = 0,
["vertical-align"] = vertAlign,
["width"] = "1em",
["max-width"] = "1em"
})
:wikitext(v)
Line 89 ⟶ 92:
wikiText = wikiText .. " unsortable"
end
wikiText = wikiText .. "\" style=\"line-height:99%;vertical-align:" ..
if stack == "" then
vertAlign .. ";padding:"
wikiText = wikiText .. "99"
else
wikiText = wikiText .. "120"
end
wikiText = wikiText .. "%;vertical-align:" .. vertAlign .. ";padding:"
if sortPadding == "" then
wikiText = wikiText .. ".4em"
Line 96 ⟶ 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
wikiText = wikiText .. " .4em .2em;background-position:50% .4em !important;"
if stack == "" then
wikiText = wikiText .. "min-width:" .. width .. ";max-width:" .. width ..