Commit ec747d6b authored by Phillip Webb's avatar Phillip Webb

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
parents 664cd15c 370998e9
...@@ -62,7 +62,7 @@ class SingleConfigurationTableEntry extends ConfigurationTableEntry { ...@@ -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 { ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment