[reportlab-users] Support of modern underline

126 views
Skip to first unread message

Claude Paroz

unread,
Apr 22, 2021, 2:58:52 AM4/22/21
to For users of Reportlab open source software
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
--
www.2xlibre.net
_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
https://pairlist2.pair.net/mailman/listinfo/reportlab-users

Robin Becker

unread,
Apr 26, 2021, 3:42:50 AM4/26/21
to reportlab-users, Claude Paroz
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

Claude Paroz

unread,
Apr 26, 2021, 4:23:18 PM4/26/21
to Robin Becker, reportlab-users
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 :

Reply all
Reply to author
Forward
0 new messages