[create]
The documentation for this module is missing. Click here to create it.
local BASE_STYLE = [====[
/***** ModularCSS/HideSpoilerTitle *****/
/* hide from wikiactivity, rc, and article content */
[=[a[href="$TITLE"]:hover]=]
{
color: #fff;
text-decoration: none !important;
}
[=[a[href="$TITLE"]]=]
{
background-color: #000;
color: #000;
}
/* prevent plainlink unmasking */
[=[.plainlinks a[href="$TITLE"]]=] { background-color: #000 !important; }
[=[.plainlinks .unobscure a[href="$TITLE"]]=]
{
background: initial !important;
}
/* custom "unobscuring" class, apply to wiki header */
[=[.wds-tabs a[href="$TITLE"],
.unobscure a[href="$TITLE"]]=]
{
background: inherit;
color: #337800; /* todo: user set */
}
/* hide from generated category galleries */
[=[.category-gallery .category-gallery-item a[href="$TITLE"]]=]
{
display: none;
}
/* spoiler postfix */
[=[a[href="$TITLE"]::after]=]
{
color: #ff0000;
font-size: 80%;
content: " (spoiler)";
}
/* prevent modifying wiki header dropdowns */
[=[.wds-tabs a[href="$TITLE"]::after,
.unobscure a[href="$TITLE"]::after]=]
{ content: none; }
[=[.wds-tabs a[href="$TITLE"]:hover,
.unobscure a[href="$TITLE"]:hover]=]
{ color: inherit; }
/* warn for spoilers in search results */
[=[.wds-global-navigation__search li[title="$STITLE"] a]=]
{ visibility: hidden; }
[=[.wds-global-navigation__search li[title="$STITLE"].wds-is-selected a]=]
{ visibility: visible; }
[=[.wds-global-navigation__search li[title="$STITLE"] a::before]=]
{ color:#ff0000; content:"SPOILER (hover to view)"; visibility: visible; }
[=[.wds-global-navigation__search li[title="$STITLE"].wds-is-selected a::before]=]
{ content: none; }
]====]
local CHUNK_CAPT = "%[=%[(.-)%]=%]"
return {
page = "Project:Spoiler titles",
main = function(parsed)
local piles = {}
-- create piles
for _,obj in pairs(parsed) do
local pile_n = 0
for chunk in BASE_STYLE:gmatch(CHUNK_CAPT) do
pile_n = pile_n + 1
piles[pile_n] = piles[pile_n] or {}
table.insert(piles[pile_n], ( chunk
:gsub( "$TITLE", obj:getLocalUrl() )
:gsub( "$STITLE", obj.self ) )
)
end
end
-- nothing provided
if #piles == 0 then return '' end
-- compile
local pile_n = 0
return BASE_STYLE:gsub(CHUNK_CAPT, function(chunk)
local compiled = ""
pile_n = pile_n + 1
pile = piles[pile_n]
for _,chunk in pairs(pile) do
compiled = compiled .. chunk .. ",\n"
end
return compiled:sub(1,-3)
end)
end
}