From fc858d1159194f7736006a9a97cd566923bb5795 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 14 Sep 2022 17:25:18 -1000 Subject: [PATCH] fix: balcmds: fix empty html columns fix (#1933) --- hledger/Hledger/Cli/Commands/Balance.hs | 24 ++++++++++++------------ hledger/test/balance/balance.test | 10 ++++++++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Balance.hs b/hledger/Hledger/Cli/Commands/Balance.hs index 7fb25c142..1900bd98b 100644 --- a/hledger/Hledger/Cli/Commands/Balance.hs +++ b/hledger/Hledger/Cli/Commands/Balance.hs @@ -577,10 +577,10 @@ multiBalanceReportHtmlHeadRow ropts (acct:cells) = let defstyle = style_ "" (amts,tot,avg) - | row_total_ ropts && average_ ropts = (ini2, sndlst2, lst2) - | row_total_ ropts = (ini1, lst1, []) - | average_ ropts = (ini1, [], lst1) - | otherwise = (amts, [], []) + | row_total_ ropts && average_ ropts = (ini2, sndlst2, lst2) + | row_total_ ropts = (ini1, lst1, []) + | average_ ropts = (ini1, [], lst1) + | otherwise = (cells, [], []) where n = length cells (ini1,lst1) = splitAt (n-1) cells @@ -601,10 +601,10 @@ multiBalanceReportHtmlBodyRow ropts (label:cells) = let defstyle = style_ "text-align:right" (amts,tot,avg) - | row_total_ ropts && average_ ropts = (ini2, sndlst2, lst2) - | row_total_ ropts = (ini1, lst1, []) - | average_ ropts = (ini1, [], lst1) - | otherwise = (amts, [], []) + | row_total_ ropts && average_ ropts = (ini2, sndlst2, lst2) + | row_total_ ropts = (ini1, lst1, []) + | average_ ropts = (ini1, [], lst1) + | otherwise = (cells, [], []) where n = length cells (ini1,lst1) = splitAt (n-1) cells @@ -630,10 +630,10 @@ multiBalanceReportHtmlFootRow ropts (acct:cells) = let defstyle = style_ "text-align:right" (amts,tot,avg) - | row_total_ ropts && average_ ropts = (ini2, sndlst2, lst2) - | row_total_ ropts = (ini1, lst1, []) - | average_ ropts = (ini1, [], lst1) - | otherwise = (amts, [], []) + | row_total_ ropts && average_ ropts = (ini2, sndlst2, lst2) + | row_total_ ropts = (ini1, lst1, []) + | average_ ropts = (ini1, [], lst1) + | otherwise = (cells, [], []) where n = length cells (ini1,lst1) = splitAt (n-1) cells diff --git a/hledger/test/balance/balance.test b/hledger/test/balance/balance.test index e3828f1b4..2972437ad 100644 --- a/hledger/test/balance/balance.test +++ b/hledger/test/balance/balance.test @@ -195,7 +195,13 @@ account b $ hledger -f - balance -NE --declared not:a 0 b -# 13. An empty totals column does not break HTML output (#1933). +# 13. An empty periodic report in HTML output does not break. < -$ hledger -f- bal -YT -O html +$ hledger -f- bal -M -O html > // + +# 14. An empty totals column in HTML output does not break (#1933). +< +$ hledger -f- bal -MT -O html +> // +