Skip to content

lib: replace remaining use of lucid with blaze for html rendering (#2737) - #2743

Merged
simonmichael merged 1 commit into
hledgerorg:mainfrom
acinader:one-html-renderer
Sep 22, 2026
Merged

simonmichael merged 1 commit into
hledgerorg:mainfrom
acinader:one-html-renderer

Conversation

@acinader

Copy link
Copy Markdown
Contributor

Closes #2737.

hledger-lib had two renderers for Write.Spreadsheet tables: Write.Html.Lucid (the CLI's -O html) and Write.Html.Blaze (hledger-web's balance page, since #2739). This settles on one, built on blaze-html, see for discussion #2321.

What changed

  • Hledger.Write.Html is now the renderer itself: Write.Html.Lucid's cell rendering translated line for line to blaze, plus the Lines class and borderClasses from Write.Html.HtmlCommon. Those two modules and Write.Html.Blaze are deleted.
  • balance, register, aregister, print, holdings, and the compound reports (bs/is/cf/bse) import Write.Html; where they wrote lucid markup directly (aregister's heading row, the compound reports' extra styles) they now write blaze markup. hledger-web's balance page only changes an import.
  • Dependencies: lucid is dropped from hledger-lib and hledger; hledger gains blaze-html, already a dependency of hledger-lib and hledger-web.
  • First unit tests for Write.Html: cell rendering (amount spans, date class, links, totals, borders, colspan/rowspan, escaping), rows, and the styled table.

Output

The CLI's HTML output is byte for byte what it was. I rendered 194 reports with the main build and with this branch and diffed them: balance (single and multi period, --tree, --transpose, --layout bare/tidy/barewide, --budget, -V, -B, --title, --base-url), bs/is/cf/bse, register, aregister (with and without heading), print, and holdings, over examples/sample.journal, examples/multicurrency.journal, a large generated journal, and a journal with multiple commodities, prices, lots, and & < > " ' in account names, descriptions, and the base URL. No differences.

hledger-web's balance now matches CLI's html output: one <span class="amount"> per amount, and a newline after each row. Pages fetched with both builds are otherwise identical.

How to test

stack build --ghc-options=-Werror --test --no-run-tests
stack exec -- hledger test '/Html/'
stack exec -- hledger -f examples/sample.journal bal -M -O html
stack exec -- hledger -f examples/sample.journal is -O html
stack exec -- hledger -f examples/sample.journal areg checking -O html

hledgerorg#2737]

- Write.Html is now the renderer
- Removed: Write.Html.Lucid, Write.Html.Blaze, Write.Html.HtmlCommon.
- balance, register, aregister, print, holdings, the compound reports,
  and hledger-web's balance page import Write.Html.
- lucid dropped from hledger-lib and hledger; blaze-html added to hledger.
- CLI html output unchanged: 194 reports compared
- Unit tests added for Write.Html.

AI usage: Claude Fable 5.1, ~70k output tokens.
@simonmichael

Copy link
Copy Markdown
Member

blaze-html hasn't had a release in 2.5 years, which makes me slightly nervous (unlike lucid). But as you say yesod depends on it, so it'll surely keep working.

@simonmichael

Copy link
Copy Markdown
Member

Thanks for the cleanup!

@simonmichael
simonmichael merged commit 63ee174 into hledgerorg:main Sep 22, 2026
2 checks passed
@acinader
acinader deleted the one-html-renderer branch September 22, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lib: settle on one HTML renderer (blaze-html), instead of lucid and blaze in parallel

2 participants