gnodet-bot commented on code in PR #1214:
URL:
https://github.com/apache/maven-plugin-tools/pull/1214#discussion_r4462584629
##########
maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverter.java:
##########
@@ -37,11 +37,15 @@
public class HtmlToPlainTextConverter implements Converter {
@Override
public String convert(String text) {
+ return convert(text, false);
+ }
+
+ String convert(String text, boolean preserveHelpWhitespace) {
Review Comment:
💡 **Missing Javadoc on package-private overload** — the NBSP-encoding
contract is non-obvious. When `preserveHelpWhitespace=true`, spaces inside
`<pre>` blocks are encoded as `U+00A0` (NBSP) so the HelpMojo template's
`toLines()` treats the content as a single word (bypassing word-wrapping) and
then decodes NBSP back to plain spaces on output. Without a comment, the next
developer will not understand why spaces are replaced with NBSP or what calls
this with `true`.
```suggestion
/**
* Converts (X)HTML to plain text, optionally encoding spaces inside
{@code <pre>} blocks
* as non-breaking spaces (U+00A0). When {@code preserveHelpWhitespace}
is {@code true},
* the generated HelpMojo template's {@code toLines()} treats NBSP as
non-breaking and
* decodes it back to a plain space on output, preserving preformatted
indentation without
* interfering with word-wrapping of ordinary text.
* <p>Used exclusively by {@link PluginDescriptorFilesGenerator} for the
* {@code LIMITED_FOR_HELP_MOJO} descriptor type.
*
* @param text the (X)HTML to convert
* @param preserveHelpWhitespace if {@code true}, encode spaces in
preformatted blocks as NBSP
* @return plain-text equivalent
*/
String convert(String text, boolean preserveHelpWhitespace) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]