html reporting for ledger

70 views
Skip to first unread message

Tim Docker

unread,
Jan 25, 2009, 11:42:40 PM1/25/09
to hle...@googlegroups.com, ledge...@googlegroups.com
I'm making available some code to produce html reports from hledger files.
It's still a work in progress, but may be useful to others.

Some sample output can be found here:

http://dockerz.net/software/hledger_report_sample/report.html

The code is available in a darcs repo here:

http://dockerz.net/repos/ledger-reports

Note that whilst this is an independent executable, it relies on the
hledger library. You'll need the most recent version of this from it's own
darcs repository.

I've attached some details below. For more details, see the README in the
source distribution.

Patches welcome.

Tim

----------------------------------------------------------------------

* ledger-reports

This is a command line program for that reads plain text "ledger"
files and produces xhtml reports showing balances, profit and loss etc.

It does this by processing an xhtml file which is a template for the
resulting output file. It:

1) reads the template file
2) substitutes any environment variables for string of the form
$(VARNAME).
3) replaces any report specification elements with the corresponding
reports.
4) writes the results as an xhtml file.

* Usage

ledger-reports <input template file> <output xhtml file>

The first argument is the template input file, and the second is where the
resulting xhtml is to be written.

A small but complete usage example can be found in the file
examples/run_example.sh subdirectory of the source distribution.

* Credits

The "ledger" file format is that of John Weigley's command line
"ledger" tool:

http://newartisans.com/software/ledger.html

The code relies heavily on Simon Michael's hledger haskell library, for
parsing and other functionality:

http://joyful.com/Hledger


Tim Docker

unread,
Mar 1, 2009, 6:38:28 AM3/1/09
to hle...@googlegroups.com, ledge...@googlegroups.com, Stephen Hicks
I've pushed a few updates to this software. The changes are:

* I've added a simple abstraction mechanism so that you can "declare
variables" containing XML snippets, and then use them in multiple
places in the the input document. This significantly reduce the
repetition required for real reports.

* I've factored out and reduced the dependencies on hledger. This
should make it easier to keep compatible as hledger progresses. The
code currently builds against hledger 0.3 (the last official version)
and 0.3.98 (the version currently in darcs).

Tim

Reply all
Reply to author
Forward
0 new messages