Skip to content

Commit 5de0581

Browse files
author
fulin
committed
fix: velocity换行问题
1 parent 537b2de commit 5de0581

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/main/java/com/fulinlin/constant/GitCommitConstants.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
**/
88
public class GitCommitConstants {
99
public static final String DEFAULT_TEMPLATE = "#if($type)${type}#end#if(${scope})(${scope})#end: #if(${subject})${subject}#end\n" +
10-
"\n" +
10+
"${newline}\n" +
1111
"#if(${body})${body}#end\n" +
12-
"\n" +
12+
"${newline}\n" +
1313
"#if(${changes})BREAKING CHANGE: ${changes}#end\n" +
14-
"\n" +
14+
"${newline}\n" +
1515
"#if(${closes})Closes ${closes}#end\n";
1616

1717
}

src/main/java/com/fulinlin/utils/VelocityUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static String convert(String template, CommitTemplate commitTemplate) {
3939
velocityContext.put("body", commitTemplate.getBody());
4040
velocityContext.put("changes", commitTemplate.getChanges());
4141
velocityContext.put("closes", commitTemplate.getCloses());
42+
velocityContext.put("newline", "\n");
4243
velocityContext.put("velocityTool", new VelocityTool());
4344
String VM_LOG_TAG = "Leetcode VelocityUtils";
4445
boolean isSuccess = engine.evaluate(velocityContext, writer, VM_LOG_TAG, template);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#if($type)${type}#end#if(${scope})(${scope})#end: #if(${subject})${subject}#end
2-
2+
${newline}
33
#if(${body})${body}#end
4-
4+
${newline}
55
#if(${changes})BREAKING CHANGE: ${changes}#end
6-
6+
${newline}
77
#if(${closes})Closes ${closes}#end

0 commit comments

Comments
 (0)