Friday, September 7, 2018

I did this using weasyprint instead of appypod. Because appypod templates are difficult to configure and maintain, and because weasyprint should be satisfying.

The most visible problem was that amounts (DecimalField) didn’t align right in the pdf printout when using weasyprint. To fix this, I replaced the cell attributes (lino.core.renderer.HtmlRenderer.cellattrs) by class="text-cell" or class="number-cell", and then define these classes in currently three places: plain/lino.css, extjs/lino.css and inline in excerpts/base.weasy.html. I don’t yet see how to unify them (and whether that’s important). on a HtmlRenderer did not render the table header when header_level was specified. That feature was being used only by TextRenderer so far. Now it is also used by annual.

We have a new method lino.core.requests.BaseRequest.show_story() which is used in the template for the report (ledger/Report/default.weazy.html).

The lino.core.renderer.HtmlRenderer.table2story() method now yields a sequence of elements instead of returning a single one.

Here are the old and the new reports on screen…

../../_images/old.png ../../_images/new.png

… and their printable pdf versions: old.pdf new.pdf

TODO: When a model defines a lino.core.model.Model.get_choices_text()