rtl reports

Josh Sled jsled at asynchronous.org
Wed May 21 13:19:45 EDT 2008


"Ori Hoch" <ori at uumpa.com> writes:
> I am trying to create rtl (right-to-left) reports for the hebrew translation
> of gnucash.

Awesome. :)

> I created a new stylesheet (stylesheet-plain-rtl.scm) and I tried to change
> some html attributes, I can change the align attributes for table cells, but
> I can't add a dir="rtl" attribute, how can it be done?

I'm not sure if GtkHtml supports @dir on <td>.  AIUI, when you export the
source on the report-generated HTML, we actually ask gtkhtml to generate the
source from its internal representation of the HTML.  And as GtkHtml has a
limited understanding of HTML (especially HTML > 3.2), it probably doesn't
parse it in the first place.

But, it does look – as you notice – like GtkHtml has some RTL support
overall.


> Another strange thing - if I look in the source of any report with any
> stylesheet, there is a <p dir=rtl> surrounding the entire body, I couldn't
> see where this comes from, I guess it's added if the locale is hebrew - but
> where does it come from? I did a search for 'RTL' on the entire gnucash
> source and it's not there, so it must come from somewhere else.

This, too, looks like GtkHTML from a cursory glance at the 3.8.2 sources I
have lying around.  It seems to understand @dir on <html>, <body> and <p>.


> One more thing.. I can see how a specific report is defined, but where is
> the entry point for actually rendering it. Where is the scheme file that
> calls the 'renderer which was defined in (gnc:define-repot ... )?

It's a bit of a nightmare ... src/report/report-gnome/window-report.c (which
is not otherwise used anymore for the UI side of reports; see
gnc-plugin-page-report.c instead) sets up a "stream" handler of url-type
"report" to be the callback gnc_html_report_stream_cb.  I believe this is
called anytime the GtkHtml widget needs to obtain the "stream" of content to
parse/render/&c.

This callback calls
    [src/report/report-system/gnc-report.c:] gnc_run_report_id_string()
which calls
    [ibid:] gnc_run_report()
which calls
    [src/report/report-system/report.scm:] (gnc:report-run)
which calls
    [ibid:] (gnc:report-render-html)
which obtains the renderer and the stylesheet and retains the html.

-- 
...jsled
http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20080521/6370e8ad/attachment.bin 


More information about the gnucash-devel mailing list