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
pull/18413/head
Phillip Webb 5 years ago
commit ec747d6b2e

@ -62,7 +62,7 @@ class SingleConfigurationTableEntry extends ConfigurationTableEntry {
private void writeDefaultValue(AsciidocBuilder builder) {
String defaultValue = (this.defaultValue != null) ? this.defaultValue : "";
defaultValue = defaultValue.replace("\\", "\\\\").replace("|", "{vbar}" + System.lineSeparator());
defaultValue = defaultValue.replace("\\", "\\\\").replace("|", "\\|");
if (defaultValue.isEmpty()) {
builder.appendln("|");
}

@ -68,8 +68,8 @@ class SingleConfigurationTableEntryTests {
SingleConfigurationTableEntry entry = new SingleConfigurationTableEntry(property);
AsciidocBuilder builder = new AsciidocBuilder();
entry.write(builder);
assertThat(builder.toString()).isEqualTo("|`+spring.test.prop+`" + NEWLINE + "|`+first{vbar}" + NEWLINE
+ "second+`" + NEWLINE + "|+++This is a description.+++" + NEWLINE);
assertThat(builder.toString()).isEqualTo("|`+spring.test.prop+`" + NEWLINE + "|`+first\\|second+`" + NEWLINE
+ "|+++This is a description.+++" + NEWLINE);
}
@Test

Loading…
Cancel
Save