[reportlab-users] Support of modern underline

Claude Paroz claude at 2xlibre.net
Mon Apr 26 16:23:12 EDT 2021


Hi Robin,

You are in a far better position than me to judge if this is feasible or 
not, as I didn't even dig myself in the code to evaluate that.
But it's certain we'll find more and more style-underlined HTML code in 
the future, so it would be a nice gain.

And no sorry, I didn't take time to test the rlPyCairo backend. I'm 
myself mostly interested by PDF rendering. However, I'm directing people 
having such issues towards testing this, so hopefully people having such 
needs will also take the time to test it.
Thanks for all your efforts.

Claude

Le 26.04.21 à 09:41, Robin Becker a écrit :
> 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


More information about the reportlab-users mailing list