Module:Random slideshow/sandbox: Difference between revisions

Content deleted Content added
pipe
fix regex
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
sortedLines[i] = sortedLines[i]:gsub(
"^(.+)(%{%{!}}alt%{%{=}}[^{]*)(.*)$",
"%1%3%2")
-- insert a switcher-label span just after the first pipe (which has already been escaped as {{!}} instead the | character)
sortedLines[i] = sortedLines[i]:gsub(
Line 45 ⟶ 49:
'{{!}}<span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image ' .. tostring(i) .. '</span></span>',
1)
-- move the alt parameter to the end of the file should it exist
sortedLines[i] = sortedLines[i]:gsub(
"^(.+)(alt=[^{]*)(.*)$",
"%1%3%2")
end
local galleryContent = table.concat(sortedLines, '\n')