mirror of
https://github.com/smogon/sprites.git
synced 2026-03-22 01:45:27 -05:00
{lua,tup}-ext: add trim
This commit is contained in:
parent
7c503abb98
commit
58eb3de07a
|
|
@ -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"}
|
||||
|
|
|
|||
|
|
@ -67,3 +67,7 @@ function mergededup(table1, table2, f)
|
|||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function trim(s)
|
||||
return s:gsub("^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user