[reportlab-users] Support of modern underline

Robin Becker robin at reportlab.com
Mon Apr 26 03:41:45 EDT 2021


Hi Claude,

have been ill for a time, but back to work now.

If I understand you you want to implement part/all of the text-decoration/line/color attributes from css and allow those 
in the platypus paragraph default parser. I believe at present the style attribute support is not implemented there at all.

There is a slight problem in that the rml parser is supposed to implement style using named styles as that parser 
already supports the creation of named styles with multiple attributes. So in <para>...<span style='special'>... we have 
a mechanism to use an existing style set which contains fontName/Size/Color etc etc. It's probably a bad idea to change 
the base paragraphs  to support css parsing unless we do it for rml as well. Of course as soon as we start on the css 
route we end up in a wormhole which is likely not a short cut.

A way out might be to allow the base parser to implement named styles in some way to be pre-defined and then to 
additionally allow some css attributes provided we can separate the two mechanisms. So we might allow

<span style='style-name-with-no-colons'>

or

<span style='someattr: somevalue;anotherattr: anothervalue'>

we could then parse in the same way for both parsers. This would complicate the parsers a bit since the allowed 
attribute names probably not always compatible with both internals.


On A completely different issue have you tested the use of rlPyCairo for you image output?



On 22/04/2021 07:58, Claude Paroz wrote:
> Hi,
> 
> The modern way of underlining in HTML is to use the <span style="text-decoration: underline;"> syntax, and many Wysiwyg 
> editors will produce that HTML in content.
> 
> Unfortunately, the default ReportLab paraparser doesn't support this syntax yet (findSpanStyle not implemented in this 
> parser).
> 
> What about adding that support in default parser? Is this a big task?
> 
> Regards,
> 
> Claude


-- 
Robin Becker


More information about the reportlab-users mailing list