Content deleted Content added
Fully turn all {{!}} into | now that tag is processed using functions rather than preprocessed text that needs escaping |
improve alt param position check by temporarily removing pipes in wikilinks during processing |
||
Line 40:
local sortedLines = nonRandom and galleryLines or randomModule.main('array', randomiseArgs)
for i = 1, #sortedLines do
-- move the alt parameter to the end of the file should it exist to fix linter errors▼
-- disable pipes in wikilinks
"%[%[(.-)|(.-)]]",
"[[%1__PIPE__%2]]")
▲ -- move
currentLine = currentLine:gsub(
"^(.+)(|alt=[^|]*)(.*)$",
"%1%3%2")
-- bring back pipes in wikilinks
-- insert a switcher-label span just after the first pipe, which should ideally be the caption▼
currentLine = currentLine:gsub(
▲ -- insert a switcher-label span just after the first pipe
▲ sortedLines[i] = sortedLines[i]:gsub(
"|",
'|<span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image ' .. tostring(i) .. '</span></span>',
1)
end
local galleryContent = table.concat(sortedLines, '\n')
|