Merge pull request #18374 from dreis2211
* pr/18374: Simplify pipe escaping for reference doc tables Avoid need to escape pipe character in reference tables Closes gh-18374
This commit is contained in:
commit
ec747d6b2e
|
@ -62,7 +62,7 @@ class SingleConfigurationTableEntry extends ConfigurationTableEntry {
|
||||||
|
|
||||||
private void writeDefaultValue(AsciidocBuilder builder) {
|
private void writeDefaultValue(AsciidocBuilder builder) {
|
||||||
String defaultValue = (this.defaultValue != null) ? this.defaultValue : "";
|
String defaultValue = (this.defaultValue != null) ? this.defaultValue : "";
|
||||||
defaultValue = defaultValue.replace("\\", "\\\\").replace("|", "{vbar}" + System.lineSeparator());
|
defaultValue = defaultValue.replace("\\", "\\\\").replace("|", "\\|");
|
||||||
if (defaultValue.isEmpty()) {
|
if (defaultValue.isEmpty()) {
|
||||||
builder.appendln("|");
|
builder.appendln("|");
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ class SingleConfigurationTableEntryTests {
|
||||||
SingleConfigurationTableEntry entry = new SingleConfigurationTableEntry(property);
|
SingleConfigurationTableEntry entry = new SingleConfigurationTableEntry(property);
|
||||||
AsciidocBuilder builder = new AsciidocBuilder();
|
AsciidocBuilder builder = new AsciidocBuilder();
|
||||||
entry.write(builder);
|
entry.write(builder);
|
||||||
assertThat(builder.toString()).isEqualTo("|`+spring.test.prop+`" + NEWLINE + "|`+first{vbar}" + NEWLINE
|
assertThat(builder.toString()).isEqualTo("|`+spring.test.prop+`" + NEWLINE + "|`+first\\|second+`" + NEWLINE
|
||||||
+ "second+`" + NEWLINE + "|+++This is a description.+++" + NEWLINE);
|
+ "|+++This is a description.+++" + NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue