From WikiChip
Difference between revisions of "Module:microarchitecture"

(Created page with "local uarch = {} function add_header_main(box, str) box :tag('tr') :tag('td') :attr('class', 'header-main') :attr('colspan', '...")
 
Line 47: Line 47:
 
'[[Category:' .. string.lower(frame.args.atype) .. ' microarchitectures by ' .. string.lower(frame.args.designer) .. ']]')
 
'[[Category:' .. string.lower(frame.args.atype) .. ' microarchitectures by ' .. string.lower(frame.args.designer) .. ']]')
  
 +
return infobox
 
end
 
end
  
 
return uarch
 
return uarch

Revision as of 20:56, 24 May 2017

Documentation for this module may be created at Module:microarchitecture/doc

local uarch = {}

function add_header_main(box, str)
      box
        :tag('tr')
          :tag('td')
            :attr('class', 'header-main')
            :attr('colspan', '2')
            :wikitext(str)
end
function add_header(box, str)
      box
        :tag('tr')
          :tag('td')
            :attr('class', 'header')
            :attr('colspan', '2')
            :wikitext(str)
end
function add_entry(box, label, value)
      local tag = box:tag('tr')
      
      tag:tag('td')
        :attr('class', 'label')
        :wikitext(label)
        
      tag:tag('td')
        :attr('class', 'value')
        :wikitext(value)
end

function uarch.uarch(frame)
    local infobox = mw.html.create('table')

    infobox
        :attr('class', 'infobox')
        
    -- header
    if not frame.args.name then return 'ERROR: "name" is missing!' end
	add_header_main(infobox, '[[codename::' .. frame.args.name .. '| ]][[name::' .. frame.args.name .. ']] µarch')

	add_header_main(infobox, 'General Info')

    -- arch type
    if not frame.args.atype then return 'ERROR: "atype" is missing!' end
	add_header_main(infobox, '[[codename::' .. frame.args.atype .. '| ]][[name::' .. frame.args.atype .. ']] µarch' ..
		'[[microarchitecture type::' .. frame.args.atype .. '| ]]' ..
		'[[Category:' .. string.lower(frame.args.atype) .. ' microarchitectures by ' .. string.lower(frame.args.designer) .. ']]')

	return infobox
end

return uarch