RFR: 8294158: HTML formatting for PassFailJFrame instructions
Alexey Ivanov
aivanov at openjdk.org
Tue Sep 12 13:18:40 UTC 2023
On Tue, 12 Sep 2023 12:44:34 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:
> Probably `trim()` and `toLowerCase()` could be useful here.
Could be… On the other hand, in post XHTML era, the elements are usually in lower-case. Thus we should stick with it and use lowercase HTML elements anyway.
I think `startsWith("<html>")` covers the scenario well.
Although neither `<html>` nor `<body>` are required, I prefer to always add them. These two elements don't add much overhead, do they?
> Do we consider adding adding one more builder method to force enable html rendering? (e.g. when we just want to highlight only few words/sentences with `<b>` without adding `<html>` tag)
I don't think it's needed. If you want the instructions rendered as HTML, you'll have to format them as HTML.
Forcing HTML rendering on plain text which highlights a couple of words with `<b>` will render the text unreadable: line ends are ignored by HTML, so you'll have to use `<br>` element to force line breaks. (A similar thing often happens in javadoc where a blank line is added as if to start a new paragraph, but without the explicit `<p>` element the text continues on the same line / paragraph.)
It is possible to wrap such instructions into `<html><body><pre>` but what stops you from doing it explicitly if it's what you want? (Note, however, the `<pre>` element disables line wrapping.)
I'd rather keep it simple.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15660#discussion_r1323028087
More information about the client-libs-dev
mailing list