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 --- draw.lua | 2 +- yarrow-ui.cgi | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/draw.lua b/draw.lua index 11b4b77..5d39cc5 100644 --- a/draw.lua +++ b/draw.lua @@ -296,7 +296,7 @@ function draw(stats, theme) {base(stats, theme)}, {traits(stats, theme)}, {actions(stats, theme)}, - --{reactions(stats, theme)}, + {reactions(stats, theme)}, {legendary(stats, theme)} ) return m.render(m.svg{ 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