On my ongoing something-released-every-friday rampage, this friday I will release a working version of Uqbar, a Gutenberg project e-texts interface.
It may use use pandoc and rst2pdf and makeztxt and other things to make e-books that are pretty to read, and work on my Sony Clie. We'll see.
This project has been "sleeping" since 2005, I think I can now, with my new focus in limited, quick development, get a reasonable version ready in two weeks.
I may slip a little rst2pdf update, too.
After that, back to Urssus.
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!
You can even use it to float almost arbitrary objects, so you can have floating images or floating figures.
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 th neat text alignment of LaTex with the floating HTML sidebar.
Here's how far I got so far:
There are some minor problems with the current implementation, such that the sidebar is always aligne 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 where the sidebar should go, then call a framebreak, insert the "real" sidebar, a "framecutter" and another framebreak.
The framecutter 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.
So, we now have 4 frames instead of one:
The text should flow from 2 to 3 neatly and the seams shouldn't show.
Here's a picture that MAY make it clear (there are 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.
Besides everything I mentioned yesterday, today I implemented two rather important features: cascading stylesheets, and user-defined page layouts. Here is a screenshot:
That neat two-column layout is done by adding this to the stylesheet:
"pageTemplates" : {
"firstPage": {
"frames": [
["0cm", "0cm", "49%", "100%"],
["51%", "0cm", "49%", "100%"]
]
}
},
The name "firstPage" is magical right now, and there's no way to change from one template to another (yet), and until I do that, I won't be releasing.
Here's what cascading stylesheets does. Suppose you want to use A5 paper and size 12 Times New Roman fonts? Here's all the stylesheet you need:
{
"pageSetup" : {
"size": "A5",
},
"fontsAlias" : {
"stdFont": "Times-Roman",
},
"styles" : [
["base" , {
"fontSize": 14,
"leading": 16
}]
]
}
Also, you can specify as many stylesheets as you want in the command line. So you can have one that sets the paper size, one for page layout as above, one for font "sets", etc.
Neat, isn't it?
How good? Let me tell you...
I am a big Alexandre Dumas fan. He's the direct ancestor of Neal Stephenson, so many of you should like him too. So I used one of his best books to try some automatic typesetting of project gutenberg texts.
No, the whole book did not convert without errors, and yes, there is some manual work in what you are about to see, but hey, take a look.
Here's a far look of the first two pages:
And here's some detail of the typsetting:
Yes, the typesetting is not really LaTeX quality, but it's not bad, either.
Compare it with the HTML version at project Gutenberg. The typesetting is a thing of beauty compared to that :-(
The image is a picture of Chateau d'If from flickr, released under Creative Commons. The title font is Scriptina, I chose it because it looks 19th century but modern.
I did a release yesterday, and another today of my rst-to-pdf-without-latex tool. What's new? Here's an incomplete list:
New in 0,4
New in 0.3
Of course, since I said I would release something every friday, this means I need to find something else to release? ;-)