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: | ||
--[[ | --[[ | ||
* Name: ElementPortraitCarousel | |||
* Author: Mark W. Datysgeld | |||
* Description: Element module that renders portrait carousels for Person templates with three display modes based on image count | |||
* 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 | |||
]] | |||
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) | ||
-- | -- Sanitize logo path - extract filename and remove prefixes | ||
imageName = imageName | 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 | ||