rst2pdf 0.7is out, better than ever!
Right on schedule, everything I promised, plus much simpler/smarter font embedding, and maybe a bag of chips. More at http://rst2pdf.googlecode.com.
Right on schedule, everything I promised, plus much simpler/smarter font embedding, and maybe a bag of chips. More at http://rst2pdf.googlecode.com.
Keeping with my new time-based release schedule, tomorrow is again rst2pdf release day! What will be new in 0.7? Several things!
Fixed several serious bugs, specially with the handling of literal blocks (preformatteds and code blocks).
Implemented a rather neat sidebar/floating block mechanism. It only lets you go float-left or float-right but it looks better than what you get in HTML, at least:
You can even use it to float almost arbitrary objects, so you can have floating images or floating figures.
Fixed the look of hyperlinks. Reportlab had a bug about making some hyperlinks underlined, and those with a black thick underline. Not when you use rst2pdf! Monkey-patched the heck out of that.
Table styling. Let me show you:
The first row is a header row. It automatically takes the table-heading style.
The following rows are regular, and they take the table style, which has support for zebra tables with alternating colors (white and gray here).
The lone red cell at the right is special. Its content is this:
.. class:: red red
If you don't know ReST, that means "red" is a paragraph with class red, so it will be styled whatever way that means (here: red background).
Usually that would mean you have a white (or gray) cell with a red paragraph in it. That looks incredibly ugly.
So, rst2pdf tries to be clever: If there is a single element in a cell, it will try to guess the cell background from it.
And as you saw above, it works :-)
Today I started a branch called SmartFrames. The main goal is to achieve a better text flow in the document (for example, for sidebars), and it is starting to get there, slowly.
Let's consider how ReST sidebars are rendered in the different writers.
We'll work with an ordinary lorem ipsum that has a sidebar declared just before it.
Here's HTML:
And here's LaTeX:
Each one has its good side and its bad side.
The HTML sidebar is a real sidebar, while the LaTex one is some sort of insert.
OTOH, the ragged text against the HTML sidebar is ... horrid.
So, I wanted something at least a bit better than that for rst2pdf. In the best of all possible worlds, it would be the neat text alignment of LaTex with the floating HTML sidebar.
Here's how it looks now:
There are some minor problems with the current implementation, such that the sidebar is always aligned to the top of a paragraph, and some spacing issues.
How is it done? Let me tell you: it was not trivial :-)
In fact it's pretty evil, but here's a quick explanation:
When I get a sidebar flowable, I insert a new frame in the page template where the sidebar should go, then call a framebreak, insert the "real" sidebar, a "framecutter" and another framebreak.
The framecutter is a flowable that does nothing visible, but inserts another two frames, one at the right of the sidebar with the same height, and another below the sidebar, full width.
I need to use the framecutter because I don't know the height of the sidebar until after it's drawn.
So, we now have 4 frames instead of one:
The original frame, covers the whole page, but has a framebreak above the sidebar.
The sidebar frame, which is very tall, but has a framebreak below the sidebar text.
A beside-the-sidebar frame, short and wide, starting at the right of the sidebar.
A below-the-sidebar frame, wide and tall, starting below the sidebar.
The text should flow from 1 to 3 to 4 neatly and the seams shouldn't show.
Here's a picture that MAY make it clear (there are some odd displacements: those were bugs):
So, I'm not calling it a success yet, but it is looking decent.
Many new features. Custom page layouts! Multiple frames per page! Multiple layouts per document! Cascading stylesheets! Not very buggy! Get it at http://rst2pdf.googlecode.com or via PyPI.