cli: Cli.Commands.Balance.multiBalanceReportAsHtml: now uses multiBalanceReportAsSpreadsheet

instead of multiBalanceReportHtmlRows.

This way, HTML output automatically supports transposition.
This commit is contained in:
Henning Thielemann 2024-10-01 18:27:00 +02:00 committed by Simon Michael
parent afc320f1ba
commit eeb070195c

View File

@ -303,7 +303,6 @@ import Hledger.Cli.Utils
import Hledger.Write.Csv (CSV, printCSV, printTSV) import Hledger.Write.Csv (CSV, printCSV, printTSV)
import Hledger.Write.Ods (printFods) import Hledger.Write.Ods (printFods)
import Hledger.Write.Html.Lucid (printHtml) import Hledger.Write.Html.Lucid (printHtml)
import Hledger.Write.Html.Attribute (tableStylesheet)
import qualified Hledger.Write.Html.Lucid as Html import qualified Hledger.Write.Html.Lucid as Html
import qualified Hledger.Write.Spreadsheet as Ods import qualified Hledger.Write.Spreadsheet as Ods
@ -822,15 +821,10 @@ multiBalanceReportAsSpreadsheetParts ishtml opts@ReportOpts{..} (PeriodicReport
-- | Render a multi-column balance report as HTML. -- | Render a multi-column balance report as HTML.
multiBalanceReportAsHtml :: ReportOpts -> MultiBalanceReport -> Html () multiBalanceReportAsHtml :: ReportOpts -> MultiBalanceReport -> Html ()
multiBalanceReportAsHtml ropts mbr = multiBalanceReportAsHtml ropts mbr =
let do
(headingsrow,bodyrows,mtotalsrows) = multiBalanceReportHtmlRows ropts mbr
in do
link_ [rel_ "stylesheet", href_ "hledger.css"] link_ [rel_ "stylesheet", href_ "hledger.css"]
style_ tableStylesheet printHtml . map (map (fmap L.toHtml)) $
table_ $ mconcat $ snd $ multiBalanceReportAsSpreadsheet ropts mbr
[headingsrow]
++ bodyrows
++ mtotalsrows
-- | Render the HTML table rows for a MultiBalanceReport. -- | Render the HTML table rows for a MultiBalanceReport.
-- Returns the heading row, 0 or more body rows, and the totals row if enabled. -- Returns the heading row, 0 or more body rows, and the totals row if enabled.