From 0c5dad8f98f8db017924a010c539785245006b11 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 23 Dec 2024 14:12:17 +0100 Subject: [PATCH] Additional clean ups for error-prone descriptions Fixes #93 --- .../java/template/processor/RefasterTemplateProcessor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java b/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java index 5be160e..0936488 100644 --- a/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java +++ b/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java @@ -485,7 +485,10 @@ private String recipeDescriptor(JCTree.JCClassDecl classDecl, String defaultDisp Tokens.Comment comment = cu.docComments.getComment(classDecl); if (comment != null && comment.getText() != null && !comment.getText().isEmpty()) { String commentText = comment.getText() - .replaceAll("\\{@\\S+\\s+(.*?)}", "`$1`") + .replace("

", "") + .replace("

{@code", "```java")
+                            .replace("}
", "```") + .replaceAll("(?s)\\{@\\S+\\s+(.*?)}", "`$1`") .replace("\\", "\\\\") .replace("\"", "\\\"") .replace("\b", "\\b")