Module:EveryCRTImages: Difference between revisions

Add storeImages/recallGallery functions — uses Lua module state to pass image list between CRT model and CRT gallery templates within same page parse (via update-page on MediaWiki MCP Server)
Fix: read images from frame.args (direct #invoke params) not frame:getParent().args; same for recallGallery mode/heights (via update-page on MediaWiki MCP Server)
Line 26: Line 26:
   end
   end
   return out
   return out
end
-- Helper: get a named arg from frame.args first, then frame:getParent().args
local function getArg(frame, name, default)
  local val = frame.args[name]
  if val and val ~= "" then return val end
  local parent = frame:getParent()
  if parent then
    val = parent.args[name]
    if val and val ~= "" then return val end
  end
  return default or ""
end
end


Line 35: Line 47:
-- Outputs nothing.
-- Outputs nothing.
function p.storeImages(frame)
function p.storeImages(frame)
   local args = frame:getParent().args
   storedImages = getArg(frame, "images", "")
  storedImages = args.images or ""
   return ""
   return ""
end
end
Line 47: Line 58:
   end
   end


   local args = frame:getParent().args
   local mode = getArg(frame, "mode", "packed")
  local mode = args.mode or "packed"
   local heights = getArg(frame, "heights", "160")
   local heights = args.heights or "160"


   local lines = {}
   local lines = {}
MediaWiki Appliance - Powered by TurnKey Linux