diff options
Diffstat (limited to 'yarrow-ui.cgi')
-rwxr-xr-x | yarrow-ui.cgi | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/yarrow-ui.cgi b/yarrow-ui.cgi index fffa653..2cbcb6a 100755 --- a/yarrow-ui.cgi +++ b/yarrow-ui.cgi @@ -60,10 +60,15 @@ in all of them you can add *italics* and **bold** text! -- stats yarrow query conversion +local function clean(str) + local str = string.gsub(str, '^%s+', '') + local str = string.gsub(str, '%s+$', '') + return str +end local function parse_traits(str) local tbl = {} for name, value in string.gmatch(str, '@([^@]-)\n([^@]+)') do - table.insert(tbl, {name=name, value=value}) + table.insert(tbl, {name=clean(name), value=clean(value)}) end return tbl end @@ -76,7 +81,7 @@ local function convert(stats) end tbl.traits = parse_traits(stats.traits) tbl.actions = parse_traits(stats.actions) - tbl.actions = parse_traits(stats.actions) + tbl.reactions = parse_traits(stats.reactions) if stats.legendary ~= '' then tbl.legendary = {} tbl.legendary.description = stats.legendary_description @@ -190,6 +195,8 @@ end local body = h('body', { form_basic, img, + h('hr'), + h('a', 'source code', { href='https://sanine.net/git/yarrow' }), }) |