Module:Instruction set table builder: Difference between revisions

Reduced font size for instruction table to shrink table width
(Added final formatting. Functions should be finished for now.)
(Reduced font size for instruction table to shrink table width)
 
(7 intermediate revisions by the same user not shown)
Line 24:
 
function formatMnemonic(str)
str = str:gsub("rd", .. "r{{sub|d}} ")
str = str:gsub("rsrd ", "r{{<sub|s}}>d</sub> ")
str = str:gsub("rtrd,", "r{{<sub|t}}>d</sub>,")
str = str:gsub("rs", "r<sub>s</sub>")
str = str:gsub("rt", "r<sub>t</sub>")
str = str:gsub("r'd", "rd")
str = str:gsub("r't", "rt")
str = str:gsub("r's", "rs")
return str
Line 64 ⟶ 70:
function p.set( frame )
local args = getArgs(frame)
local s = "{| class=\"wikitable\" style=\"text-align: center; font-size: 85%;\"\n! Mnemonic !! Description !! 32-bit Instruction Word\n"
local arr = {}
Line 73 ⟶ 79:
for i = 1, #arr, 4 do
local mnemonic = formatMnemonic( string.gsub(string.format("%-10s", arr[i]), " ", "&nbsp;") .. arr[i + 1] )
mnemonic = mnemonic:gsub(arr[i], "[[#"..arr[i].."|"..arr[i].."]]")
local descrip = formatDescription( arr[i + 2] )
local word = string.addSpacing(string.gsub(arr[i + 3], " ", ""), 4)
s = s .. "|-\n"
s = s .. "| style=\"text-align: left; font-family: Consolas,Monaco,Lucida Console,monospace; padding: 1px 7px 1px 7px;\"| " .. mnemonic
.. " || style=\"text-align: left; font-family: Consolas,Monaco,Lucida Console,monospace; padding: 1px 7px 1px 7px;\"| " .. descrip
.. " || style=\"font-family: Consolas,Monaco,Lucida Console,monospace; padding: 1px 7px 1px 7px;\"| " .. word
.. "\n"
end