Module:ElementPortraitCarousel: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
--[[  
--[[
* Module:ElementPortraitCarousel
* Name: ElementPortraitCarousel
* Renders a portrait carousel for person templates with 3 display modes:
* Author: Mark W. Datysgeld
* 1. Single image - Simple centered display
* Description: Element module that renders portrait carousels for Person templates with three display modes based on image count
* 2. Dual images - Orbital display with animation
* Notes: Single image (centered display); dual images (orbital display with animation); multi-image (full carousel with navigation arrows); integrates with Blueprint template system; image sanitization; protected execution with error handling
* 3. Multi-image - Full carousel with navigation arrows
]]
*
* Integrates with Blueprint template system.
]]


local p = {}
local p = {}
Line 15: Line 12:
-- Load required modules
-- Load required modules
local ErrorHandling = require('Module:ErrorHandling')
local ErrorHandling = require('Module:ErrorHandling')
local TemplateHelpers = require('Module:TemplateHelpers')


-- Default configuration
-- Default configuration
Line 31: Line 29:
     for image in portrait:gmatch("[^;]+") do
     for image in portrait:gmatch("[^;]+") do
         local imageName = mw.text.trim(image)
         local imageName = mw.text.trim(image)
         -- Remove "File:" prefix, case-insensitively
         -- Sanitize logo path - extract filename and remove prefixes
         imageName = imageName:gsub("^[Ff][Ii][Ll][Ee]:", "")
         imageName = TemplateHelpers.sanitizeUserInput(imageName, "IMAGE_FILES")
         -- Store just the image name, we'll use MediaWiki's renderer
         -- Store just the image name, we'll use MediaWiki's renderer
         if imageName and imageName ~= "" then
         if imageName and imageName ~= "" then