Phil Longstaff wrote:
The basic flow is that in the C code, the report engine asks the html code to show a uri such as "report:id=3". The html code sees the uri type "report" and calls the report engine back to supply it with html. The report engine then returns a string with the html code. I don't know why gnc-document gets in there.

Because on the Guile side, most reports use calls to gnc:html-document-add-object! and a host of other such functions that build up a gnc-document -- a complex 'object' (probably a 'record' in Guile-speak) that later gets converted into HTML. Reports using eguile-gnc just create the HTML, and currently have to convert it to a gnc-document so that the correct type of data is returned by the report function. My patch below by-passes the conversion from HTML to gnc-document and back again.

cheers

Chris

Phil

------------------------------------------------------------------------
*From:* Chris Dennis <[email protected]>
*To:* Phil Longstaff <[email protected]>
*Cc:* Gnucash list <[email protected]>
*Sent:* Monday, March 30, 2009 3:00:16 AM
*Subject:* Re: Webkit status (updated)

Phil Longstaff wrote:
> So, at this point, with libwebkit-1.0-1 and libwebkit-dev installed (on kubuntu), I can replace use of gtkhtml by webkit.
Excellent!

Would it also be possible to include the option for a report to return a simple HTML string rather than a gnc document? My new-fangled eguile-based reports (see http://bugzilla.gnome.org/show_bug.cgi?id=574582) create such an HTML string, and then convert it to a gnc document, and then it gets converted straight back again.

In fact I think all that is required to achieve this is the following patch (which I've edited to avoid wrapping, but you get the gist):

Index: report.scm
===================================================================
--- report.scm    (revision 18001)
+++ report.scm    (working copy)
@@ -633,8 +633,11 @@
              (stylesheet (gnc:report-stylesheet report))
              (doc (renderer report))
              (html #f))
-        (gnc:html-document-set-style-sheet! doc stylesheet)
-        (set! html (gnc:html-document-render doc headers?))
+        (if (string? doc)
+          (set! html doc)
+          (begin
+            (gnc:html-document-set-style-sheet! doc stylesheet)
+            (set! html (gnc:html-document-render doc headers?))))
        (gnc:report-set-ctext! report html) ;; cache the html
        (gnc:report-set-dirty?! report #f)  ;; mark it clean
        html)

cheers

Chris
-- Chris Dennis [email protected] <mailto:[email protected]>
Fordingbridge, Hampshire, UK


--
Chris Dennis                                  [email protected]
Fordingbridge, Hampshire, UK
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to