Posts about python (old posts, page 25)

2009-06-22 09:35

AAFigure in rst2pdf

As of today, rst2pdf supports Chris Liechti's awesome aafigure.

What does it mean? It means you can put this in your document:

+-------+       +-------+
|   A   |------>|   B   |
+-------+       +-------+

And get this (and as a PDF drawing, not as an image, so you can copy the text from it):

/static/aafigure.png

So it's an awesome way to add simple diagrams to your restructured text documents that look good in plain text, on the web, and on PDF.

Aafigure can create lots of interesting drawings, check their docs for examples here

It currently requires aafigure from bzr (0.3 won't work).

2009-06-19 19:13

Rst2pdf 0.11 released!

It's my pleasure to announce the release of rst2pdf version 0.11, available at http://code.google.com/p/rst2pdf/downloads/list

Rst2pdf is a tool to generate PDF files directly from restructured text sources via reportlab.

This version includes many bugfixes and some new features compared to the previous 0.10.1 version, including but not limited to embedding PDF images, much improved image sizing, nicer list layouts, better styling, page backgrounds, and more than 15 bugs fixed. A full changelog is included at the bottom of this message.

Rst2pdf aims to support the full restructured text feature set, and is very close to that goal, while also including some of the more experimental features, like a source code directive with syntax highlighting and math notation support with LaTeX-like syntax.

It supports embedding arbitrary fonts, both True Type and PS Type 1, both raster and vector images (including SVG), page transition effects, multiple, flexible page layouts, cascading styles, and much, much more.

You can find more information about rst2pdf in its home page ( http://rst2pdf.googlecode.com), and ask anything you want in the rst2pdf- discuss mailing list (http://groups.google.com/group/rst2pdf-discuss)

Here are the changes in this version compared to 0.10.1:

  • Degrade more gracefully when one or more wordaxe hyphenators are broken (currently DWC is the broken one)
  • Fixed issue 132: in some cases, with user-defined fontAlias, bold and italic would get confused (getting italic instead of bold in inline markup, for instance).
  • New stylesheet no-compact-lists to make lists... less compact
  • SVG images now handle % as a width unit correctly.
  • Implemented issue 127: support images in PDF format. Right now they are rasterized, so it's not ideal. Perhaps something better will come up later.
  • Fixed issue 129: make it work around a prblem with KeepTogether in RL 2.1 it probably makes the output look worse in some cases when using that. RL 2.1 is not really supported, so added a warning.
  • Fixed issue 130: use os.pathsep instead of ":" since ":" in windows is used in disk names (and we still pay for DOS idiocy, in 2009)
  • Fixed issue 128: headings level 3+ all looked the same
  • Ugly bugfix for Issue 126: crashes when using images in header + TOC
  • New tstyles section in the stylesheet provides more configurable list layouts and more powerful table styling.
  • Better syntax highlighting (supports bold/italic)
  • Workaround for issue 103 so you can use borderPadding as a list (but it will look wrong if you are using wordaxe <= 0.3.2)
  • Added fieldvalue style for field lists
  • Added optionlist tstyle, for option lists
  • Added collection of utility stylesheets and documented it
  • Improved command line parsing and stylesheet loading (guess extension like latest rst2latex does)
  • Fixed Issue 67: completely new list layouting code
  • Fixed Issue 116: crashes caused by huge images
  • Better support for %width in images, n2ow it's % of the container frame's width, not of the text area.
  • Fixed bug in SVG scaling
  • Better handling of missing images
  • Added missing styles abstract, contents, dedication to the default stylesheet
  • Tables style support spaceBefore and spaceAfter
  • New topic-title style for topic titles (obvious ;-)
  • Vertical alignment for inline images (:align: parameter)
  • Issue 118: Support for :scale: in images and handle resizing of inline images
  • Issue 119: Fix placement of headers and footers
  • New background property for page templates (nice for presentations, for example)
  • Default to px for image width specifications instead of pt
  • Support all required measurement units ("em" "ex" "px" "in" "cm" "mm" "pt" "pc" "%" "")
  • New automated scripts to check test cases for "visual differences"
  • Respect images DPI property a bit like rst2latex does.
  • Issue 110: New --inline-footnotes option
  • Tested with reportlab from SVN trunk
  • Support for Dinu Gherman's svglib. If both svglib and uniconvertor are available, svglib is preferred (for SVG, of course). Patch originally by rute.
  • Issue 109: Separate styles for each kind of admonition
  • For Issue 109: missing styles are not a fatal error
  • Issue 117: TOCs with more than 6 levels now supported (raised limit to 9, which is silly deep)

2009-05-29 14:40

rst2pdf progress report

Since the last release, there have been many changes, improvements and fixes in rst2pdf.

At the bottom of this post you will find (maybe incomplete) list, but I wanted to share a couple of relatively large advances.


Presentations

I have wanted to make rst2pdf useful for presentations for quite a while. And now it's getting close.

I am writing a small tutorial about it, but you can see a demo already.

The changes that make this possible are:

  • Fixed bugs regarding page layout
  • Added support for page backgrounds (including SVG!)

This was in large part because of César Rodas, who wanted something simple and text-based to do his ZendCon presentation, so he asked me about it, and I was ashamed to give him a broken tool.

See how that works? I am driven by embarrassment. That's embarrasing.


Major stylesheet improvements

The related changes are way too many (see below), but it also happened for a reason: I wanted to make prettier documents.

So, since most people seems to like Sphinx's style, I wanted to look similar.

Did I achieve it? Yes and no, take a look:

web-sphinx rst2pdf-sphinx

But it's just a draft, I didn't look at fonts, or weight of the headings, or even at what pygments color scheme sphinx is using.

But anyway, even this rough stylesheet made me find a dozen bugs or problems in rst2pdf.

So, the main lesson here is, please tell me what you can and can't do with rst2pdf, because there are whole areas I am not even looking at, day-to-day.


The final thing is... the next release is going to be awesome. But then again, I always say that, don't I?


Changes as of today:

  • Workaround for issue 103 so you can use borderPadding as a list (but it will look wrong if you are using wordaxe <= 0.3.2)
  • Added fieldvalue style for field lists
  • Added optionlist tstyle, for option lists
  • Added collection of utility stylesheets and documented it
  • Improved command line parsing and stylesheet loading (guess extension like latest rst2latex does)
  • Fixed Issue 67: completely new list layouting code
  • Fixed Issue 116: crashes caused by huge images
  • Better support for %width in images, n2ow it's % of the container frame's width, not of the text area.
  • Fixed bug in SVG scaling
  • Better handling of missing images
  • Added missing styles abstract, contents, dedication to the default stylesheet
  • Tables style support spaceBefore and spaceAfter
  • New topic-title style for topic titles (obvious ;-)
  • Vertical alignment for inline images (:align: parameter)
  • Issue 118: Support for :scale: in images and handle resizing of inline images
  • Issue 119: Fix placement of headers and footers
  • New background property for page templates (nice for presentations, for example)
  • Default to px for image width specifications instead of pt
  • Support all required measurement units ("em" "ex" "px" "in" "cm" "mm" "pt" "pc" "%" "")
  • New automated scripts to check test cases for "visual differences"
  • Respect images DPI property a bit like rst2latex does.
  • Issue 110: New --inline-footnotes option
  • Tested with reportlab from SVN trunk
  • Support for Dinu Gherman's svglib. If both svglib and uniconvertor are available, svglib is preferred (for SVG, of course). Patch originally by rute.
  • Issue 109: Separate styles for each kind of admonition
  • For Issue 109: missing styles are not a fatal error
  • Issue 117: TOCs with more than 6 levels now supported (raised limit to 9, which is silly deep)

2009-05-17 13:51

Sorry about rst2pdf 0.10, have some 0.10.1 instead.

So, rst2pdf 0.10 was not ok. The setup.py that worked on 0.9 simply didn't work for the new version.

Good thing is, Christoph actually undestands setuptools, so he could fix it and deliver a neat 0.10.1 for your PDF-generating pleasure.

Post 0.10.1, I have already fixed one bug, Issue 117.

2009-05-15 00:01

Released rst2pdf 0.10!

After 8 months (!) it's finally out: rst2pdf 0.10 ready for downloading from its homepage.

If you don't know what I'm talking about, rst2pdf lets you create PDF files from a simple, very lightly marked pure text format called restructured text and is the easiest way to create nice documentation for your free software project and more!

Here is the manual which is created using rst2pdf itself from this.

And here's a (maybe partial) list of the changes, which should convince you that you really want this version:

  • Issue 87: Table headers can be repeated in each page (thanks to Yasushi Masuda)
  • Issue 93: Line number support for code blocks (:linenos: true)
  • Issue 111: Added --no-footnote-backlinks option
  • Issue 107: Support localized directives/roles (example: sommaire instead of contents)
  • Issue 112: Fixed crash when processing empty list items
  • Issue 98: Nobreak support, and set as default for inline-literals so they don't hyphenate.
  • Slightly better tests
  • Background colors in text styles work with reportlab 2.3
  • Issue 99: Fixed hyphenation in headers/footers (requires wordaxe 0.3.2)
  • Issue 106: Crash on demo.txt fixed (requires wordxe 0.3.2)
  • Issue 102: Implemented styles for bulleted and numbered lists
  • Issue 38: Default headers/footers via options, config file or stylesheet
  • Issue 88: Implemented much better book-style TOCs
  • Issue 100: Fixed bug with headers/footers and Reportlab 2.3
  • Issue 95: Fixed bug with indented tables
  • Issue 89: Implemented --version
  • Issue 84: Fixed bug with relative include paths
  • Issue 85: Fixed bug with table cell styles
  • Issue 83: Fixed bug with numeric colors in backColor attribute
  • Issue 44: Support for stdin and stdout
  • Issue 79: Added --stylesheet-path option
  • Issue 80: Send warnings to stderr, not stdout
  • Issue 66: Implemented "smart quotes"
  • Issue 77: Work around missing matplotlib
  • Proper translation of labels (such as "Author", "Version" etc.) using the docutils languages package. (r473)
  • Fixed problems with wrong or non-existing fonts. (r484)
  • Page transition effect support for presentations (r423)

2009-05-14 10:10

A bit more work in rst2pdf

A bit of time today, too:

  • Started looking at issue reported by msoulier (not reproduced yet)
  • Implemented improvement requested in Issue 111 in r520 (including docs and sample config file). Now it needs to be verified by adk2012
  • Verified Issue 106 isn't happening anymore and closed it.
  • Closed Issue 76 as WontFix because I am not keeping RL2.1 installed :-(
  • Closed Issue 99 because it's fixed in wordaxe 0.3.2

UPDATE: The changelog in SVN is getting more than long enough to deserve a new release!

2009-05-13 11:03

rst2pdf bugfixes

After an awfully long time, I set aside one hour for coding, and spent it on bugfixing for rst2pdf.

Not much work (the fixes were very simple) but at least I am doing something. Important since some people actually use this program ;-)

2009-04-12 10:32

PyQt by Example (Session 4) in spanish! (and some thanks)

Thanks to Leonardo De Luca, session 4 is now available in spanish

Also, thanks to:

  • ZeD who pointed out a bug in session 2 and wrote a sphinx config file (works very well!)
  • Emanuele Rampichini who pointed out a bug (which I have not fixed yet)
  • Simon Edwards who posted about this series in his blog and pointed out some differences if you want to use PyKDE instead of PyQt.

Contents © 2000-2018 Roberto Alsina