In light of recent discussions, I've been thinking about ways to
generate more complex documents or reports with ledger.

In most languages, this is done by creating a templating or document
embedding method, where data is injected next to arbitrary content,
ranging from a simple "mail merge" to more complex behaviors.

There seem to be 3 different ways that could be pursued for this:

 - Come up with a ledger specific templating engine, building on
existing work.

 - Use the new python functionality to implement similar functionality
with one of python's templating engines (mako, evoque, etc.)

 - Change XML output from it's current form (which is similar to bal
and reg and is pretty flat) to be more of an output filter that wraps
arbitrary queries and other output, then use XSLT or other XML tools
to fill templates.

Personally, I'm thinking that the 3rd option is likely the
easiest/most language neutral/repurposeable for other uses, but #2 is
also quite attractive.

Has anyone looked into doing something like this?

Some (quite horrible) pseudocode that gets at what I think people
might be wanting:

--
{for $customer in ledger.balance("Company:Customers").has_uncleared}

Invoice for {$customer.accountname}

Items purchased:
{for $transaction in $customer.transactions.uncleared}
    Item: {$transaction.description}  for {$transaction.amount}
{/for}

Total: {$customer.balance}

Thank you for your prompt payment.

{/for}
--

Thoughts?

Zack

Reply via email to