mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +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 Stephane Nicoll
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
* @author Moritz Halbritter
|
||||||
*/
|
*/
|
||||||
class ChangelogWriter implements AutoCloseable {
|
class ChangelogWriter implements AutoCloseable {
|
||||||
|
|
||||||
@ -198,8 +199,18 @@ class ChangelogWriter implements AutoCloseable {
|
|||||||
return (value != null) ? "`%s`".formatted(value) : null;
|
return (value != null) ? "`%s`".formatted(value) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeCell(String format, Object... args) {
|
private void writeCell(String content) {
|
||||||
write((format != null) ? "| %s%n".formatted(format) : "|%n", args);
|
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) {
|
private void write(String format, Object... args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user