Modul:UniquePropertyValuesCards
Aus Stadtsprachen
Die Dokumentation für dieses Modul kann unter Modul:UniquePropertyValuesCards/Doku erstellt werden
local uniqueValuesModule = require('Module:UniquePropertyValues')
local p = {}
function p.wrapValuesInDivs(frame)
local propertyName = frame.args[1]
local colAmount = frame.args[2] or "3" -- Default to 3 if not specified
-- Get unique values using the other module
local uniqueValues = uniqueValuesModule.getUniqueValues(propertyName)
-- Create a list of <div> elements with the specified structure
local divs = {}
for _, value in ipairs(uniqueValues) do
local link = value -- Use the value directly, which contains the wiki link
table.insert(divs,
'<div class="col-12 col-md-' .. colAmount .. ' text-center d-flex flex-column mb-1 px-1">' ..
'<div class="card hover-card p-2 d-flex justify-content-center align-items-center" style="height: 100%;>' ..
link ..
'</div>' ..
'</div>'
)
end
-- Return all <div> elements concatenated as a single string
return table.concat(divs, "\n")
end
return p