prawnpdf/prawn — pull request #353 by cs (2012-05-30 15:35:41+00:00)
Title: Support for `<span>` together with `style` and `class` attributes in `Prawn::Text::Formatted::Parser`

Prawn formatting supports `` tags, but not `` elements. As you all know, `` tags aren't supported by recent version of HTML (i.e. HTML5).

Therefore, using `` seem to be a bit cumbersome. Imagine, you want the user to edit the PDF's content in a browser using a WYSIWYG editor. You cannot do that with ``, while keeping all the HTML code valid.

To fix this problem, my pull request introduces support for `` elements including `style` and `class` attributes in `Prawn::Text::Formatted::Parser`.

`style` attributes contain list of ordinary CSS properties. At the moment, the following properties are supported:

* `font-family` ==>
`...` is equivalent to
`...`
* `font-size` ==>
`...` is equivalent to
`...`
* `letter-spacing` ==>
`...` is equivalent to
`...`

With these three properties, `` tags can be completely replaced!

`class` attributes work similar to `style` attributes. However, before the actual CSS happens, the class name has to be mapped to a CSS string. This is accomplished by using a lookup mechanism, which has to be supplied by the user (therefore allowing the user specify the meaning of particular class names).