mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Escape pipe symbol in properties changelog table cells
Closes gh-38515
This commit is contained in:
parent
169070ea1b
commit
d172b22064
@ -46,6 +46,7 @@ import org.springframework.boot.configurationmetadata.Deprecation;
|
||||
* @author Stephane Nicoll
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class ChangelogWriter implements AutoCloseable {
|
||||
|
||||
@ -198,8 +199,18 @@ class ChangelogWriter implements AutoCloseable {
|
||||
return (value != null) ? "`%s`".formatted(value) : null;
|
||||
}
|
||||
|
||||
private void writeCell(String format, Object... args) {
|
||||
write((format != null) ? "| %s%n".formatted(format) : "|%n", args);
|
||||
private void writeCell(String content) {
|
||||
if (content == null) {
|
||||
write("|%n");
|
||||
}
|
||||
else {
|
||||
String escaped = escapeForTableCell(content);
|
||||
write("| %s%n".formatted(escaped));
|
||||
}
|
||||
}
|
||||
|
||||
private String escapeForTableCell(String content) {
|
||||
return content.replace("|", "\\|");
|
||||
}
|
||||
|
||||
private void write(String format, Object... args) {
|
||||
|
Loading…
Reference in New Issue
Block a user