From ef8fcc0889fe217c3170f45644e108ff61e666a0 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 18 Sep 2023 14:33:48 +0000 Subject: fix reactions and add source code link --- yarrow-ui.cgi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'yarrow-ui.cgi') 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' }), }) -- cgit v1.2.1