Module:EveryCRTImages: Difference between revisions

Created page with "local p = {} local function trim(s) return (s:gsub("^%s+", ""):gsub("%s+$", "")) end local function normalize_file_title(s) s = trim(s or "") if s == "" then return nil end -- If user pasted "File:Something.jpg", drop the prefix and re-add consistently s = s:gsub("^%s*[Ff]ile%s*:%s*", "") -- MediaWiki titles prefer underscores internally; spaces usually work too, -- but underscores avoid edge cases in SMW "Page" values. s = s:gsub("%s+", "_") retur..."
 
No edit summary
Line 63: Line 63:
   if #lines == 0 then return "" end
   if #lines == 0 then return "" end


   return string.format(
   local wikitext = string.format(
     '<gallery mode="%s" heights="%s">\n%s\n</gallery>',
     '<gallery mode="%s" heights="%s">\n%s\n</gallery>',
     mode, heights, table.concat(lines, "\n")
     mode, heights, table.concat(lines, "\n")
   )
   )
  return frame:preprocess(wikitext)
end
end


return p
return p
MediaWiki Appliance - Powered by TurnKey Linux