From WikiChip
Module:family

To add this template, simple add
{{family}}
to the page and save. The chip infobox will have a small [Edit Values] button at the top-right corner which can be used to add values using a form.
local p = {}
local origArgs

function p.add_file_prefix(str)
  if string.match(string.lower(str), '^file:') then
    return str
  else
    return 'File:' .. str
  end
end

function p.add_separator(box, title)
  box:tag('tr')
           :tag('td')
           :attr('class', 'header')
           :attr('colspan', '2')
           :wikitext(title)
end

function add_header(box, str)
      box
        :tag('tr')
          :tag('td')
            :attr('class', 'header')
            :attr('colspan', '2')
            :wikitext(str)
end

function p.add_entry(value, right)
  local e = mw.html.create('tr')
  e:tag('td')
    :attr('class', 'label')
    :wikitext(value)
  e:node(right)
  return e   
end

function has_arg(name)
	-- The argument can exist and be empty or not exist at all
	return string.len(origArgs[name] or '') > 0
end

function arg(name)
	return origArgs[name]
end

function p.set_val(prop, val)
	p.frame:preprocess('{{#set: ' .. prop .. '=' .. val .. '}}')	
end

function p.family(frame)
	
	p.frame = frame
    if frame == mw.getCurrentFrame() then
        origArgs = frame:getParent().args
    else
        origArgs = frame.args
    end
	
	
    local infobox = mw.html.create('table')

    infobox
        :attr('class', 'infobox')
        
    infobox
    	:tag('tr')
			:tag('td'):attr('colspan', '2')
			:tag('small'):attr('style', 'float: left; font-weight: bold;')
            :wikitext('[[Special:FormEdit/family/' .. frame:preprocess('{{FULLPAGENAME}}') .. '|<i class="fa fa-edit"></i>Edit Values]]')

    -- header
    if has_arg('name') then
      infobox
        :tag('tr')
          :tag('td')
            :attr('class', 'header-main')
            :attr('colspan', '2')
            :wikitext('[[name::' .. arg('name') .. ']]')
    end
    
    -- image
    for i = 1, 10 do
    	local name = (i == 1) and "" or " " .. i
		if has_arg('image' .. name) then
	      local image = p.add_file_prefix(arg('image' .. name))
	      local image_size = has_arg('image' .. name .. ' size') and arg('image' .. name .. ' size') or "200px" 
	      infobox
	        :tag('tr')
	          :tag('td')
	            :attr('style', 'text-align: center;')
	            :attr('colspan', '2')
		    	-- make sure it's the ogimage
	            :wikitext('[[main image::' .. image .. '| ]][[' .. image .. '|class=wikichip_ogimage|' .. image_size .. ']]')
	
	      -- add a caption, if provided
	      if has_arg('caption' .. name) then
	        infobox
	          :tag('tr')
	            :tag('td')
	            :attr('style', 'text-align: center;')
	              :attr('colspan', '2')
	              :wikitext('[[main image caption::' .. arg('caption' .. name) .. ']]')
	      end
		elseif not has_arg('no image' .. name) then
			if i == 1 then
		      infobox
		        :tag('tr')
		          :tag('td')
		            :attr('style', 'text-align: center;')
		            :attr('colspan', '2')
		            :wikitext('[[File:no photo (ic).svg|link=|200px]]')
	        end
	    end
	end


    -- ####################################################################
    -- some general info first
    
    if has_arg('developer') or has_arg('manufacturer') or has_arg('first launched')
    	or has_arg('first announced') or has_arg('fate') then
    	p.add_separator(infobox, 'General Info')
    end
    
    -- designer
    if has_arg('developer') then
      	local designers = mw.html.create('td'):attr('style', 'width: 99%;')
      	designers:wikitext('[[designer::' .. arg('developer') .. '| ]][[' .. arg('developer') .. ']]')
		for i = 2, 10 do
			if not has_arg('developer ' .. i) then break end
			designers:wikitext(', [[designer::' .. arg('developer ' .. i) .. '| ]][[' .. arg('developer ' .. i) .. ']]')
		end
   	  infobox:node(p.add_entry('Designer', designers))
	end
    
    -- manufacturer
    if has_arg('manufacturer') then
		local manufacturers = '[[manufacturer::' .. arg('manufacturer') .. '| ]][[' .. arg('manufacturer') .. ']]'
		for i = 2, 10 do
			if not has_arg('manufacturer ' .. i) then break end
			manufacturers = manufacturers .. ', [[manufacturer::' .. arg('manufacturer ' .. i) .. '| ]][[' .. arg('manufacturer ' .. i) .. ']]'
		end
		infobox:node(p.add_entry('Manufacturer', mw.html.create('td'):wikitext(manufacturers)))
	end
	
	-- release date
	if has_arg('first launched') or has_arg('first announced') then
	  local release = mw.html.create('td')
	  if has_arg('first announced') then
	    release:wikitext('[[first announced::' .. arg('first announced') .. ']] (announced)')
	  end
	  if has_arg('first launched') then
	  	if has_arg('first announced') then
	  	  release:wikitext('<br>')	
  		end
	    release:wikitext('[[first launched::' .. arg('first launched') .. ']] (launched)')
	  end
	  infobox:node(p.add_entry('Introduction', release))
	end
	
	if has_arg('fate') then
		infobox:node(p.add_entry('Fate', mw.html.create('td'):wikitext('[[fate::' .. arg('fate') .. ']]')))
	end
	
    -- ####################################################################
    -- some general info first
    
    if has_arg('isa') or has_arg('isa family') or has_arg('microarch') then
    	p.add_separator(infobox, 'Microarchitecture')
    end

	-- ISA
    if has_arg('isa') or has_arg('isa family') then
      local isa = mw.html.create('td'):wikitext('[[isa::' .. arg('isa') .. ']]')
      for i = 2, 10 do
      	if not has_arg('isa ' .. i) then break end
      	isa:wikitext(', [[isa::' .. arg('isa ' .. i) .. ']]')
      end
      if has_arg('isa family') then
        isa:wikitext('&nbsp;([[isa family::' .. arg('isa family') .. ']])')
  	  end
   	  infobox:node(p.add_entry('ISA', isa))
	end
	
	
	-- microarch
    if has_arg('microarch') then
      local microarchs = mw.html.create('td')
      microarchs:wikitext('[[microarchitecture::' .. arg('microarch') .. '| ]]')
      microarchs:wikitext('[[' .. mw.ustring.lower(arg('developer')) .. '/microarchitectures/' ..
      		mw.ustring.lower(arg('microarch')) .. '|' .. arg('microarch') .. ']]')
      for i = 2, 10 do
      	if not has_arg('microarch ' .. i) then break end
      	microarchs:wikitext(', [[microarchitecture::' .. arg('microarch ' .. i) .. '| ]]')
        microarchs:wikitext('[[' .. mw.ustring.lower(arg('developer')) .. '/microarchitectures/' ..
      		mw.ustring.lower(arg('microarch ' .. i)) .. '|' .. arg('microarch ' .. i) .. ']]')
      end
   	  infobox:node(p.add_entry('Microarchitecture', microarchs))
	end
	
	-- word size
	if has_arg('word') then
	  infobox:node(p.add_entry('Word Size', mw.html.create('td'):wikitext('[[word size::' .. arg('word') .. '| ]]' .. arg('word'))))
	end
	
	-- process
    if has_arg('proc') then
      local process = mw.html.create('td'):wikitext('[[process::' .. arg('proc') .. ']]')
      for i = 2, 10 do
      	if not has_arg('proc ' .. i) then break end
      	process:wikitext(', [[process::' .. arg('proc ' .. i) .. ']]')
      end
   	  infobox:node(p.add_entry('Process', process))
	end
	
	-- Technology
	if has_arg('tech') then
	  infobox:node(p.add_entry('Technology', mw.html.create('td'):wikitext('[[technology::' .. arg('tech') .. ']]')))
	end
	
	-- Clock
	if has_arg('clock') then
	  infobox:node(p.add_entry('Clock', mw.html.create('td'):wikitext(arg('clock'))))
	elseif has_arg('clock min') then
	  infobox:node(p.add_entry('Clock', mw.html.create('td'):wikitext(arg('clock min') .. ' - ' .. arg('clock max'))))
	end
	
    -- ####################################################################
    -- ####################################################################
    -- Packaging
    if has_arg('package module 1') or has_arg('package name 1') or has_arg('back image') then
        p.add_separator(infobox, 'Packaging')
    end
    
    -- Packaging
    if has_arg('package name 1') then
    	local pdata = require('Module:packaging data')
		for i = 1, 10 do
		    if has_arg('package name ' .. i) then
		        local package_name = arg('package name ' .. i)
		        local package_location = {}
		        for field in string.gmatch(package_name, "([^,]+),?") do
		            table.insert(package_location, field)
		        end
		        
		        -- company, package
		        local package_info = pdata['packages'][package_location[1]][package_location[2]]
		        
		        -- name
		        if package_info.p_name ~= nil then
			        local package_name
			        for key,name in ipairs(package_info.p_name) do
			            package_name = (package_name == nil) and name or package_name .. ', ' .. name
						p.set_val('package', name)
			        end
			        
			        if package_info.p_type ~= nil then
			        	package_name = package_name .. ' (' .. package_info.p_type .. ')'
		        	end
			        
			        infobox:node(p.add_entry('Package', mw.html.create('td'):wikitext(package_name)))
			        
			        if package_info.p_type ~= nil then
			        	package_name = package_name .. '(' .. package_info.p_type .. ')'
	        		end
        		end
        	
        		-- dimensions
        		if package_info.p_size ~= nil then
        			local package_dimension = package_info.p_size[1] .. ' × ' .. package_info.p_size[2]
        			if package_info.p_size[3] ~= nil then
        				package_dimension = package_dimension .. ' × ' .. package_info.p_size[3]
    				end
			        infobox:node(p.add_entry('Dimension', mw.html.create('td'):wikitext(package_dimension)))
    			end
        	
        		-- pitch
        		if package_info.p_pitch ~= nil then
			        local package_pitch
			        for key,pitch in ipairs(package_info.p_pitch) do
			            package_pitch = (package_pitch == nil) and pitch or package_pitch .. ' × ' .. pitch
			        end
			        infobox:node(p.add_entry('Pitch', mw.html.create('td'):wikitext(package_pitch)))
    			end
        	
        		-- contacts
        		if package_info.p_contacts ~= nil then
			        infobox:node(p.add_entry('Contacts', mw.html.create('td'):wikitext(package_info.p_contacts)))
    			end
        	
        		-- socket
        		if package_info.p_socket ~= nil then
			        local package_socket
			        for key,socket in ipairs(package_info.p_socket) do
			            package_socket = (package_socket == nil) and socket or package_socket .. ', ' .. socket
						p.set_val('socket', socket)
			        end
			        infobox:node(p.add_entry('Socket', mw.html.create('td'):wikitext(package_socket)))
    			end
		        
		    end
		end
	end

    -- back_image
	if has_arg('back image') then
		local back_image = p.add_file_prefix(arg('back image'))
		local back_image_size = has_arg('back image size') and arg('back image size') or "200px" 
		infobox
		:tag('tr')
		  :tag('td')
		    :attr('style', 'text-align: center;')
		    :attr('colspan', '2')
		    -- make sure it's the ogimage
		    :wikitext('[[' .. back_image .. '|link=|' .. back_image_size .. ']]')
		
		p.set_val('back image', back_image)
	end

    -- ####################################################################
    -- ####################################################################
    -- Successon
	if has_arg('successor') or has_arg('predecessor') then
		add_header(infobox, 'Succession')
		
		local s = infobox:tag('tr')
		local td = s:tag('td'):attr('colspan', '2')
		local d1 = td:tag('div'):attr('style', 'display: inline-flex;')
		local d2 = td:tag('div'):attr('style', 'display: inline-flex; float: right;')
		if has_arg('predecessor') then
			
		    local list
		    if has_arg('predecessor link') then
				list = '[[' .. arg('predecessor link') .. '|' .. arg('predecessor') .. ']]'
			else
				list = '[[' .. arg('predecessor') .. ']]'
			end
		    for i = 2, 10 do
		    	if not has_arg('predecessor ' .. i) then break end
		    	if has_arg('predecessor ' .. i .. ' link') then
		    		list = list .. '<br>[[' .. arg('predecessor ' .. i .. ' link') .. '|' .. arg('predecessor ' .. i) .. ']]'
	    		else
		    		list = list .. '<br>[[' .. arg('predecessor ' .. i) .. ']]'
    			end
			end
			
			d1:tag('div')
				:attr('style', 'float: left; padding-right: 10px; margin: auto 5px;')
				:wikitext('<i class="fa fa-chevron-left"></i>')
			d1:tag('div')
				:attr('style', 'float: left;')
				:wikitext(list)
		end
		if has_arg('successor') then
			local list
		    if has_arg('successor link') then
				list = '[[' .. arg('successor link') .. '|' .. arg('successor') .. ']]'
			else
				list = '[[' .. arg('successor') .. ']]'
			end
		    for i = 2, 10 do
		    	if not has_arg('successor ' .. i) then break end
		    	if has_arg('successor ' .. i .. ' link') then
		    		list = list .. '<br>[[' .. arg('successor ' .. i .. ' link') .. '|' ..
		    			arg('successor ' .. i) .. ']]'
	    		else
		    		list = list .. '<br>[[' .. arg('successor ' .. i) .. ']]'
    			end
			end
			
			d2:tag('div')
				:attr('style', 'float: left;')
				:wikitext(list)
			d2:tag('div')
				:attr('style', 'float: right; padding-left: 10px; margin: auto 5px;')
				:wikitext('<i class="fa fa-chevron-right"></i>')
		end
	end
    -- Contemporary
	if has_arg('contemporary') then
		add_header(infobox, 'Contemporary')
		
		local s = infobox:tag('tr')
		local td = s:tag('td'):attr('colspan', '2')
		
		td:attr('style', 'text-align: center;')

	    local list
	    if has_arg('contemporary link') then
			list = '[[' .. arg('contemporary link') .. '|' .. arg('contemporary') .. ']]'
		else
			list = '[[' .. arg('contemporary') .. ']]'
		end
	    for i = 2, 10 do
	    	if not has_arg('contemporary ' .. i) then break end
	    	if has_arg('contemporary ' .. i .. ' link') then
	    		list = list .. '<br>[[' .. arg('contemporary ' .. i .. ' link') .. '|' .. arg('contemporary ' .. i) .. ']]'
    		else
	    		list = list .. '<br>[[' .. arg('contemporary ' .. i) .. ']]'
			end
		end
		
		td:wikitext(list)
	end
	
    return infobox
end

return p