diff options
author | sanine <sanine.not@pm.me> | 2023-09-18 14:33:48 +0000 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-09-18 14:33:48 +0000 |
commit | ef8fcc0889fe217c3170f45644e108ff61e666a0 (patch) | |
tree | 20ec61f7a53a1c2a554052f09508cc9e967ba73d /yarrow-ui.cgi | |
parent | ea194b4cad05f003b7bad5e7e5f059d745c64995 (diff) |
fix reactions and add source code link
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' }), }) |