diff --git a/Tupfile.lua b/Tupfile.lua index 4e89edf8..f68cc7b0 100644 --- a/Tupfile.lua +++ b/Tupfile.lua @@ -43,7 +43,8 @@ tup.rule( makecmd{ display="pokemonicons-pokeball-sheet", [[ -convert -background transparent -gravity center -extent 40x30 %f +append %o]], +convert -background transparent -gravity center -extent 40x30 %f +append %o +]], compresspng{config="SPRITESHEET"} }, {"build/ps/pokemonicons-pokeball-sheet.png"} diff --git a/util/lua-ext.lua b/util/lua-ext.lua index 40ab95d9..df06c28d 100644 --- a/util/lua-ext.lua +++ b/util/lua-ext.lua @@ -67,3 +67,7 @@ function mergededup(table1, table2, f) end return result end + +function trim(s) + return s:gsub("^%s*(.-)%s*$", "%1") +end diff --git a/util/tup-ext.lua b/util/tup-ext.lua index f9cde6c7..2d28393a 100644 --- a/util/tup-ext.lua +++ b/util/tup-ext.lua @@ -46,10 +46,15 @@ end function makecmd(cmds) local cmd = "" - if cmds.display then - cmd = rep{"^ {display}^ ", display=cmds.display} - cmds.display = nil + for newcmd in iter(flatten(cmds)) do + newcmd = trim(newcmd) + if cmd ~= "" then + cmd = cmd .. " && " + end + cmd = cmd .. newcmd + end + if cmds.display then + cmd = rep{"^ {display}^ {cmd}", display=cmds.display, cmd=cmd} end - cmd = cmd .. table.concat(flatten(cmds), " && ") return cmd end