Content deleted Content added
m better comment |
Quick test with moving the alt but at a different point |
||
Line 45:
'{{!}}<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')
Line 123 ⟶ 127:
-- remove loose opening braces which don't have matching closing braces (and the subsequent content, which is probably just a template name)
file = mw.ustring.gsub(file, '{{.-([|%]])', '%1')
-- -- move the alt parameter to the end of the file should it exist
-- file = mw.ustring.gsub(file, "%[%[(.+)(|alt=[^|%]]*)(.*)%]%]","[[%1%3%2]]")
-- replace pipes and equals (which would otherwise break the {{#tag:}} syntax)
file = mw.ustring.gsub(file, '|%s*alt%s*=', '{{!}}alt=')
|