Module:TheoristEngagements
Jump to navigation
Jump to search
Documentation for this module may be created at Module:TheoristEngagements/doc
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame)
local root = mw.html.create('div')
-- Check if there are any theorist engagements
local has_theorists = false
for i = 1, 20 do
if args['theorist_' .. i .. '_name'] then
has_theorists = true
break
end
end
if not has_theorists then return '' end
-- Role type to color mapping (similar to concept relations)
local role_colors = {
originator = '#3498db', -- Blue
origin = '#3498db', -- Blue
reformulation = '#9b59b6', -- Purple
critique = '#e74c3c', -- Red
extension = '#2ecc71', -- Green
systematization = '#1abc9c' -- Teal
}
-- Build theorist engagement blocks
for i = 1, 20 do
local name = args['theorist_' .. i .. '_name']
if not name then break end
local role = args['theorist_' .. i .. '_role']
local key_move = args['theorist_' .. i .. '_key_move']
local texts = args['theorist_' .. i .. '_texts']
-- Create block
local block = root:tag('div'):addClass('theorist-block')
-- Determine border color based on role
if role then
local role_lower = mw.ustring.lower(role)
local color_found = false
for keyword, color in pairs(role_colors) do
if mw.ustring.find(role_lower, keyword, 1, true) then
block:css('border-left-color', color)
color_found = true
break
end
end
if not color_found then
block:css('border-left-color', '#95a5a6')
end
end
-- Header with theorist name and role
local header = block:tag('div'):addClass('theorist-header')
-- Clean name (remove wikilink brackets if present)
local clean_name = mw.ustring.gsub(name, '%[%[', '')
clean_name = mw.ustring.gsub(clean_name, '%]%]', '')
header:wikitext('[[' .. clean_name .. ']]')
if role then
header:tag('span')
:addClass('theorist-role-tag')
:wikitext(role)
end
-- Key move/contribution
if key_move then
block:tag('div')
:addClass('theorist-key-move')
:wikitext(key_move)
end
-- Key texts
if texts then
block:tag('div')
:addClass('theorist-texts')
:wikitext('<strong>Key texts:</strong> ' .. texts)
end
end
return tostring(root)
end
return p