diff --git a/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt b/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt
index 069f241b3..52f8aeba8 100644
--- a/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt
+++ b/maven-plugin-plugin/src/it/help-basic-jdk11/expected-help.txt
@@ -10,6 +10,15 @@ help-jdk11:test
Available parameters:
+ codeExample
+ A parameter with a preformatted example.
+
{@code
+ *
+ * https://example.test/plugin.exe
+ *
+ * }
+ * unindented code spaces + * tabbed code spaces+ */ + @Parameter + private String codeExample; + /** * This parameter is deprecated. * diff --git a/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/expected-help.txt b/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/expected-help.txt index c3aeb824a..53559d209 100644 --- a/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/expected-help.txt +++ b/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/expected-help.txt @@ -6,7 +6,11 @@ help-deprecated-annotation-only:test MOJO-DESCRIPTION. Some "quotation" marks and backslashes '\\', some important javadoc - and an inline link to test.AnotherMojo . + and an inline link to test.AnotherMojo . Nested list: + * Outer + * A nested item with enough words to exceed the help line width and preserve its indentation when rendered. + first line + second line Available parameters: diff --git a/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/src/main/java/test/MyMojo.java b/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/src/main/java/test/MyMojo.java index 73ea59107..e8d82be62 100644 --- a/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/src/main/java/test/MyMojo.java +++ b/maven-plugin-plugin/src/it/help-basic/help-deprecated-annotation-only/src/main/java/test/MyMojo.java @@ -26,6 +26,15 @@ * MOJO-DESCRIPTION. Some "quotation" marks and backslashes '\\', some important javadoc
+ * first line + * second line + *+ * * @since 2.1 */ @Deprecated diff --git a/maven-plugin-plugin/src/it/help-basic/help/expected-help.txt b/maven-plugin-plugin/src/it/help-basic/help/expected-help.txt index 2bed0f0d1..b59187f78 100644 --- a/maven-plugin-plugin/src/it/help-basic/help/expected-help.txt +++ b/maven-plugin-plugin/src/it/help-basic/help/expected-help.txt @@ -6,7 +6,11 @@ help:test MOJO-DESCRIPTION. Some "quotation" marks and backslashes '\\', some important javadoc - and an inline link to test.AnotherMojo . + and an inline link to test.AnotherMojo . Nested list: + * Outer + * A nested item with enough words to exceed the help line width and preserve its indentation when rendered. + first line + second line Available parameters: diff --git a/maven-plugin-plugin/src/it/help-basic/help/src/main/java/test/MyMojo.java b/maven-plugin-plugin/src/it/help-basic/help/src/main/java/test/MyMojo.java index 480fdbc77..1051c7a93 100644 --- a/maven-plugin-plugin/src/it/help-basic/help/src/main/java/test/MyMojo.java +++ b/maven-plugin-plugin/src/it/help-basic/help/src/main/java/test/MyMojo.java @@ -26,6 +26,15 @@ * MOJO-DESCRIPTION. Some "quotation" marks and backslashes '\\', some important javadoc
+ * first line + * second line + *+ * * @deprecated As of 1.0, use the "quoted" goal instead. * @since 2.1 */ diff --git a/maven-plugin-plugin/src/it/v4api-4x/invoker.properties b/maven-plugin-plugin/src/it/v4api-4x/invoker.properties index 5a80f791c..a4d493058 100644 --- a/maven-plugin-plugin/src/it/v4api-4x/invoker.properties +++ b/maven-plugin-plugin/src/it/v4api-4x/invoker.properties @@ -19,3 +19,5 @@ invoker.java.version = 17+ invoker.goals.1 = clean install invoker.goals.2 = org.apache.maven.its:v4api:1.0-SNAPSHOT:first invoker.maven.version = 4+ + +invoker.goals.3 = --log-file help.log org.apache.maven.its:v4api:1.0-SNAPSHOT:help diff --git a/maven-plugin-plugin/src/it/v4api-4x/src/main/java/org/apache/maven/its/v4api/FirstMojo.java b/maven-plugin-plugin/src/it/v4api-4x/src/main/java/org/apache/maven/its/v4api/FirstMojo.java index d2c3e17eb..967d6ec6e 100644 --- a/maven-plugin-plugin/src/it/v4api-4x/src/main/java/org/apache/maven/its/v4api/FirstMojo.java +++ b/maven-plugin-plugin/src/it/v4api-4x/src/main/java/org/apache/maven/its/v4api/FirstMojo.java @@ -35,6 +35,9 @@ * - it's using a custom lifecycle which is not defined * - it has a @Inject dependency on ArtifactInstaller (hint=test) which does not exist * + *
unindented code spaces + * tabbed code spaces+ * * @since 1.2 */ @Mojo(name = "first", defaultPhase = "integration-test") diff --git a/maven-plugin-plugin/src/it/v4api-4x/verify.groovy b/maven-plugin-plugin/src/it/v4api-4x/verify.groovy index 1fed69783..9471ff1e5 100644 --- a/maven-plugin-plugin/src/it/v4api-4x/verify.groovy +++ b/maven-plugin-plugin/src/it/v4api-4x/verify.groovy @@ -80,4 +80,7 @@ assert parameter.expression.isEmpty() assert new File( basedir, "target/classes/org/apache/maven/its/v4api/HelpMojo.class" ).isFile() assert new File( basedir, "target/generated-sources/plugin/org/apache/maven/its/v4api/HelpMojo.java" ).isFile() +def helpLog = new File(basedir, "help.log").text.replace("\r", "") +assert helpLog.contains(" unindented code spaces\n tabbed code spaces") + return true; diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverter.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverter.java index fd52e0249..919e793e2 100644 --- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverter.java +++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverter.java @@ -37,11 +37,29 @@ public class HtmlToPlainTextConverter implements Converter { @Override public String convert(String text) { + return convert(text, false); + } + + /** + * Converts (X)HTML to plain text, optionally encoding spaces inside {@code
} blocks + * as XML-safe non-breaking spaces (U+00A0) for the limited help descriptor. + * The generated help templates preserve these spaces during word wrapping and decode + * them to ordinary spaces on output. Ordinary prose keeps its existing wrapping behavior. + * + *{@link PluginDescriptorFilesGenerator} enables this only for + * {@code LIMITED_FOR_HELP_MOJO}; {@link #convert(String)} and standard descriptors + * retain ordinary spaces. + * + * @param text the (X)HTML to convert + * @param preserveHelpWhitespace whether to encode preformatted spaces for generated help + * @return the plain-text equivalent, with encoded preformatted spaces when requested + */ + String convert(String text, boolean preserveHelpWhitespace) { if (StringUtils.isBlank(text)) { return text; } Document document = Jsoup.parse(text); - return getPlainText(document); + return getPlainText(document, preserveHelpWhitespace); } /** @@ -50,8 +68,8 @@ public String convert(String text) { * @param element the root element to format * @return formatted text */ - private String getPlainText(Element element) { - FormattingVisitor formatter = new FormattingVisitor(); + private String getPlainText(Element element, boolean preserveHelpWhitespace) { + FormattingVisitor formatter = new FormattingVisitor(preserveHelpWhitespace); NodeTraversor.traverse(formatter, element); // walk the DOM, and call .head() and .tail() for each node return formatter.toString(); @@ -59,18 +77,31 @@ private String getPlainText(Element element) { // the formatting rules, implemented in a breadth-first DOM traverse private static class FormattingVisitor implements NodeVisitor { + private static final char PRE_START = '\u0001'; + private static final char PRE_END = '\u0002'; + // Placeholder for indentation spaces that must survive the whitespace cleanup in toString(), which // otherwise collates any run of real spaces -- including nested
elements are invalid HTML; Jsoup normalises them before traversal.
+ private int preformatted;
+ private final boolean preserveHelpWhitespace;
+
+ FormattingVisitor(boolean preserveHelpWhitespace) {
+ this.preserveHelpWhitespace = preserveHelpWhitespace;
+ }
+
// hit when the node is first seen
public void head(Node node, int depth) {
String name = node.nodeName();
if (node instanceof TextNode) {
- accum.append(((TextNode) node).text()); // TextNodes carry all user-readable text in the DOM.
+ TextNode textNode = (TextNode) node;
+ // TextNode#text() normalizes whitespace. Keep the original text inside preformatted blocks.
+ accum.append(preformatted > 0 ? textNode.getWholeText() : textNode.text());
} else if (name.equals("li")) {
accum.append('\n');
for (int i = 1; i < listDepth; i++) {
@@ -81,6 +112,12 @@ public void head(Node node, int depth) {
listDepth++;
} else if (name.equals("dt")) {
accum.append(" ");
+ } else if (name.equals("pre")) {
+ if (accum.length() > 0 && accum.charAt(accum.length() - 1) != '\n') {
+ accum.append('\n');
+ }
+ accum.append(PRE_START);
+ preformatted++;
} else if (StringUtil.in(name, "p", "h1", "h2", "h3", "h4", "h5", "tr")) {
accum.append("\n");
}
@@ -89,10 +126,22 @@ public void head(Node node, int depth) {
// hit when all of the node's children (if any) have been visited
public void tail(Node node, int depth) {
String name = node.nodeName();
- if (name.equals("ul") || name.equals("ol")) {
+ boolean preformattedEndsWithNewline = false;
+ if (name.equals("pre")) {
+ preformatted--;
+ preformattedEndsWithNewline = accum.length() > 0 && accum.charAt(accum.length() - 1) == '\n';
+ accum.append(PRE_END);
+ if (!preformattedEndsWithNewline) {
+ accum.append('\n');
+ }
+ } else if (name.equals("br")) {
+ accum.append('\n');
+ } else if (StringUtil.in(name, "dd", "dt", "p", "h1", "h2", "h3", "h4", "h5")) {
+ if (accum.length() == 0 || accum.charAt(accum.length() - 1) != '\n') {
+ accum.append("\n");
+ }
+ } else if (name.equals("ul") || name.equals("ol")) {
listDepth = Math.max(0, listDepth - 1);
- } else if (StringUtil.in(name, "br", "dd", "dt", "p", "h1", "h2", "h3", "h4", "h5")) {
- accum.append("\n");
} else if (name.equals("a")) {
// link is empty if it cannot be made absolute
String link = node.absUrl("href");
@@ -104,12 +153,31 @@ public void tail(Node node, int depth) {
@Override
public String toString() {
- // collate multiple consecutive spaces, then turn the indentation placeholders -- untouched by the
- // collation above since they aren't spaces -- into the real spaces they stand for.
- return accum.toString()
- .replaceAll(" +", " ")
- .replace("\n ", "\n")
- .replace(String.valueOf(INDENT_MARKER), " ");
+ String text = accum.toString();
+ StringBuilder result = new StringBuilder(text.length());
+ int start = 0;
+ int preStart;
+ while ((preStart = text.indexOf(PRE_START, start)) >= 0) {
+ appendNormalText(result, text.substring(start, preStart));
+ int preEnd = text.indexOf(PRE_END, preStart);
+ if (preEnd < 0) {
+ appendNormalText(result, text.substring(preStart + 1));
+ return result.toString();
+ }
+ String preformattedText = text.substring(preStart + 1, preEnd);
+ // Help templates already decode NBSP after word wrapping. Keep spaces inside
+ // preformatted blocks out of that wrapping without changing ordinary descriptors.
+ result.append(preserveHelpWhitespace ? preformattedText.replace(' ', '\u00a0') : preformattedText);
+ start = preEnd + 1;
+ }
+ appendNormalText(result, text.substring(start));
+ return result.toString();
+ }
+
+ private static void appendNormalText(StringBuilder result, String text) {
+ String normalText =
+ text.replaceAll(" +", " ").replace("\n ", "\n").replace(String.valueOf(INDENT_MARKER), " ");
+ result.append(normalText.replaceAll(" +(?=\\n|$)", ""));
}
}
}
diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java
index e1f6ffdc8..75e9ddfaf 100644
--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java
+++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java
@@ -216,7 +216,7 @@ private static String getTextValue(DescriptorType type, boolean containsXhtmlVal
xhtmlText = text;
}
if (type != DescriptorType.XHTML) {
- return new HtmlToPlainTextConverter().convert(text);
+ return new HtmlToPlainTextConverter().convert(text, type == DescriptorType.LIMITED_FOR_HELP_MOJO);
} else {
return xhtmlText;
}
diff --git a/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm b/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm
index 5cb0bb170..1e2d66109 100644
--- a/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm
+++ b/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm
@@ -379,9 +379,27 @@ public class HelpMojo
String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
- for ( String plainLine : plainLines )
+ for ( int i = 0; i < plainLines.length; i++ )
{
- toLines( lines, ind + plainLine, indentSize, lineLength );
+ String plainLine = plainLines[i];
+ if ( plainLine.trim().isEmpty() )
+ {
+ boolean previousLineIsPreformatted = i > 0
+ && !plainLines[i - 1].trim().isEmpty()
+ && plainLines[i - 1].startsWith( " " );
+ boolean nextLineIsPreformatted = i + 1 < plainLines.length
+ && !plainLines[i + 1].trim().isEmpty()
+ && plainLines[i + 1].startsWith( " " );
+ // The whitespace-only line before a preformatted block is a boundary, not displayed content.
+ if ( !nextLineIsPreformatted || previousLineIsPreformatted )
+ {
+ lines.add( "" );
+ }
+ }
+ else
+ {
+ toLines( lines, ind + plainLine, indentSize, lineLength );
+ }
}
return lines;
@@ -400,6 +418,30 @@ public class HelpMojo
int lineIndent = getIndentLevel( line );
StringBuilder buf = new StringBuilder( 256 );
+ // Preserve nested-list indentation (spaces) and preformatted indentation (NBSPs) instead of wrapping them.
+ if ( lineIndent < line.length()
+ && ( line.charAt( lineIndent ) == ' ' || line.charAt( lineIndent ) == '\u00A0' ) )
+ {
+ for ( int j = 0; j < line.length(); j++ )
+ {
+ char c = line.charAt( j );
+ if ( c == '\t' )
+ {
+ buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
+ }
+ else if ( c == '\u00A0' )
+ {
+ buf.append( ' ' );
+ }
+ else
+ {
+ buf.append( c );
+ }
+ }
+ lines.add( buf.toString() );
+ return;
+ }
+
String[] tokens = line.split( " +" );
for ( String token : tokens )
diff --git a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
index 794ed18a1..499ba1cff 100644
--- a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
+++ b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
@@ -369,9 +369,27 @@ public class HelpMojo
String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
- for ( String plainLine : plainLines )
+ for ( int i = 0; i < plainLines.length; i++ )
{
- toLines( lines, ind + plainLine, indentSize, lineLength );
+ String plainLine = plainLines[i];
+ if ( plainLine.trim().isEmpty() )
+ {
+ boolean previousLineIsPreformatted = i > 0
+ && !plainLines[i - 1].trim().isEmpty()
+ && plainLines[i - 1].startsWith( " " );
+ boolean nextLineIsPreformatted = i + 1 < plainLines.length
+ && !plainLines[i + 1].trim().isEmpty()
+ && plainLines[i + 1].startsWith( " " );
+ // The whitespace-only line before a preformatted block is a boundary, not displayed content.
+ if ( !nextLineIsPreformatted || previousLineIsPreformatted )
+ {
+ lines.add( "" );
+ }
+ }
+ else
+ {
+ toLines( lines, ind + plainLine, indentSize, lineLength );
+ }
}
return lines;
@@ -390,6 +408,30 @@ public class HelpMojo
int lineIndent = getIndentLevel( line );
StringBuilder buf = new StringBuilder( 256 );
+ // Preserve nested-list indentation (spaces) and preformatted indentation (NBSPs) instead of wrapping them.
+ if ( lineIndent < line.length()
+ && ( line.charAt( lineIndent ) == ' ' || line.charAt( lineIndent ) == '\u00A0' ) )
+ {
+ for ( int j = 0; j < line.length(); j++ )
+ {
+ char c = line.charAt( j );
+ if ( c == '\t' )
+ {
+ buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
+ }
+ else if ( c == '\u00A0' )
+ {
+ buf.append( ' ' );
+ }
+ else
+ {
+ buf.append( c );
+ }
+ }
+ lines.add( buf.toString() );
+ return;
+ }
+
String[] tokens = line.split( " +" );
for ( String token : tokens )
diff --git a/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverterTest.java b/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverterTest.java
index a3a95de9b..d74da133c 100644
--- a/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverterTest.java
+++ b/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/HtmlToPlainTextConverterTest.java
@@ -85,6 +85,33 @@ void explicitNewline() {
converter.convert(test));
}
+ @Test
+ void consecutiveExplicitLineBreaksArePreserved() {
+ assertEquals("before\n\nafter", converter.convert("before
after"));
+ assertEquals("before\n\nafter\n", converter.convert("before
after
"));
+ }
+
+ @Test
+ void preformattedTextPreservesWhitespace() {
+ String test =
+ "For example:\n <binary>\n <url>https://example.test/plugin.exe</url>\n </binary>\n
";
+ assertEquals(
+ "For example:\n \n https://example.test/plugin.exe \n \n",
+ converter.convert(test));
+ }
+
+ @Test
+ void preformattedTextWithoutTrailingNewlinePreservesWhitespace() {
+ assertEquals("before\n first\n second\nafter", converter.convert("before first\n second
after"));
+ }
+
+ @Test
+ void multiplePreformattedBlocksPreserveTheirBoundaries() {
+ assertEquals(
+ "one\n first\nmiddle\nsecond \nend",
+ converter.convert("one first
middlesecond
end"));
+ }
+
@ParameterizedTest(name = "{0} to {1}") // With JUnit 6.0.0 the non-printable chars will be kept in display, see
// https://docs.junit.org/current/user-guide/#writing-tests-parameterized-tests-display-names-quoted-text
@MethodSource("provideConvertParamsBreakLines")
@@ -127,9 +154,26 @@ void nestedListIsIndented() {
assertEquals("\n* Outer one\n * Inner one\n * Inner two\n* Outer two", converter.convert(test));
}
+ @Test
+ void nestedListAndPreformattedTextPreserveBothWhitespaceRules() {
+ String test = "first\n second
Description
first\n second\n"; + assertEquals( + "\nDescription\n\n\u00a0\u00a0first\n\u00a0\u00a0\u00a0\u00a0second\n", + ((HtmlToPlainTextConverter) converter).convert(test, true)); + } } diff --git a/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGeneratorTest.java b/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGeneratorTest.java index 30803fb40..e0463a3a2 100644 --- a/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGeneratorTest.java +++ b/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGeneratorTest.java @@ -18,6 +18,8 @@ */ package org.apache.maven.tools.plugin.generator; +import javax.xml.parsers.DocumentBuilderFactory; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -25,6 +27,7 @@ import java.io.StringReader; import java.io.StringWriter; import java.net.URI; +import java.nio.file.Path; import java.util.List; import org.apache.maven.plugin.descriptor.DuplicateParameterException; @@ -32,11 +35,17 @@ import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; +import org.apache.maven.project.MavenProject; +import org.apache.maven.tools.plugin.DefaultPluginToolsRequest; +import org.apache.maven.tools.plugin.ExtendedMojoDescriptor; import org.apache.maven.tools.plugin.javadoc.JavadocLinkGenerator; import org.codehaus.plexus.component.repository.ComponentDependency; import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.util.ReaderFactory; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -46,6 +55,45 @@ * @author Jason van Zyl */ class PluginDescriptorFilesGeneratorTest extends AbstractGeneratorTestCase { + @ParameterizedTest + @EnumSource(PluginDescriptorFilesGenerator.DescriptorType.class) + void preformattedWhitespaceIsEncodedOnlyForHelp( + PluginDescriptorFilesGenerator.DescriptorType type, @TempDir Path directory) throws Exception { + String description = "ordinary prose
unindented spaces\n\t tabbed spaces \n" + + "a long preformatted line that must not lose its spaces\n" + + "after prose"; + ExtendedMojoDescriptor mojo = new ExtendedMojoDescriptor(true); + mojo.setGoal("example"); + mojo.setImplementation("ExampleMojo"); + mojo.setDescription(description); + PluginDescriptor plugin = new PluginDescriptor(); + mojo.setPluginDescriptor(plugin); + plugin.addMojo(mojo); + File output = directory.resolve("plugin.xml").toFile(); + new PluginDescriptorFilesGenerator() + .writeDescriptor(output, new DefaultPluginToolsRequest(new MavenProject(), plugin), type); + String actual = ((org.w3c.dom.Element) DocumentBuilderFactory.newInstance() + .newDocumentBuilder() + .parse(output) + .getElementsByTagName("mojo") + .item(0)) + .getElementsByTagName("description") + .item(0) + .getTextContent(); + String plain = new HtmlToPlainTextConverter().convert(description); + if (type == PluginDescriptorFilesGenerator.DescriptorType.XHTML) { + assertEquals(description, actual); + } else if (type == PluginDescriptorFilesGenerator.DescriptorType.STANDARD) { + assertEquals(plain, actual); + } else { + assertEquals( + "ordinary prose\nunindented\u00a0\u00a0spaces\n\t\u00a0tabbed\u00a0\u00a0spaces\u00a0\u00a0\n" + + "a\u00a0\u00a0long\u00a0\u00a0preformatted\u00a0\u00a0line\u00a0\u00a0that\u00a0\u00a0must\u00a0\u00a0not\u00a0\u00a0lose\u00a0\u00a0its\u00a0\u00a0spaces\nafter prose", + actual); + assertEquals(plain, actual.replace('\u00a0', ' ')); + } + } + @Override protected void extendPluginDescriptor(PluginDescriptor pluginDescriptor) throws DuplicateParameterException { Parameter parameterWithGenerics = new Parameter();