GnuCash reports via eguile - probably not
Chris Dennis
cgdennis at btinternet.com
Tue Jan 20 13:33:27 EST 2009
Hello folks
I've been looking into ways of adapting eguile[1] to make it easier to
write GnuCash reports as HTML templates with bits of embedded Scheme code.
It works up to a point -- the point at which it fails completely.
I've merged code from the hello-world.scm report with eguile, and
created a template that works with GnuCash. BUT it can't access any
variables from GnuCash, so it's a bit pointless.
The show-stopper is that 'eval-string' runs in with a top-level (i.e.
empty) environment, so it's impossible to pass parameters (such as
report-obj) to any of the code in the template.
Thinking it through, even if it were possible to pass parameters to the
template code, we'd be opening a huge security risk. We'd be
encouraging Joe User to create a template containing code that has full
access to the workings of GnuCash.
What is really needed is some sort of wiki-like markup that can be
parsed by Guile code and includes references to GnuCash objects.
Something like this (I know the 'variable' names I've used are very
un-GnuCash-like), for which I've used TiddlyWiki-like markup:
!Invoice $invoice-no
!!$company-name
$company-address
|!Date |!Description | Qty| Cost| Total|
$for-each-invoice-line
|$inv-item-date[i] |!inv-item-desc[i] | $inv-item-qty[i]| \
$inv-item-cost[i]| $inv-item-total[i]|
$end-for
|"Total" | | | | "$inv-total"|
I wrote something similar many years ago (in Turbo Pascal, and creating
LaTeX code), but I don't really want to reinvent that wheel.
Does anyone know of a suitable Guile/Scheme module for doing this sort
of thing?
cheers
Chris
[1] http://woozle.org/~neale/src/eguile/
--
Chris Dennis cgdennis at btinternet.com
Fordingbridge, Hampshire, UK
More information about the gnucash-devel
mailing list