Polish "Escape reserved asciidoc character in generated documentation"
See gh-17663
This commit is contained in:
@@ -76,7 +76,8 @@ class SingleConfigurationTableEntry extends ConfigurationTableEntry {
|
||||
builder.append("|");
|
||||
}
|
||||
else {
|
||||
builder.append("|+++", this.description.replace("|", "\\|"), "+++");
|
||||
String cleanedDescription = this.description.replace("|", "\\|");
|
||||
builder.append("|+++", cleanedDescription, "+++");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,13 +90,12 @@ class SingleConfigurationTableEntryTests {
|
||||
void descriptionWithPipe() {
|
||||
ConfigurationMetadataProperty property = new ConfigurationMetadataProperty();
|
||||
property.setId("spring.test.prop");
|
||||
property.setDefaultValue("first\\second");
|
||||
property.setDescription("This is a description with a | pipe.");
|
||||
property.setType("java.lang.String");
|
||||
SingleConfigurationTableEntry entry = new SingleConfigurationTableEntry(property);
|
||||
AsciidocBuilder builder = new AsciidocBuilder();
|
||||
entry.write(builder);
|
||||
assertThat(builder.toString()).isEqualTo("|`+spring.test.prop+`" + NEWLINE + "|`+first\\\\second+`" + NEWLINE
|
||||
assertThat(builder.toString()).isEqualTo("|`+spring.test.prop+`" + NEWLINE + "|" + NEWLINE
|
||||
+ "|+++This is a description with a \\| pipe.+++" + NEWLINE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user