Skip to content

Commit 0df1a7f

Browse files
committed
Handle all action processing in a single macro; simplifies rest of file
Fix up indentation for actions with no issue details Fix up indentation for actions with shorter issue details git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1334145 13f79535-47bb-0310-9956-ffa450edef68
1 parent 618ef8f commit 0df1a7f

1 file changed

Lines changed: 31 additions & 72 deletions

File tree

src/changes/release-notes.vm

Lines changed: 31 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -25,108 +25,67 @@ $introduction.replaceAll("(?<!\015)\012", "
2525
$release.description.replaceAll(" ", "
2626
")
2727

28-
## Fix up indentation for multi-line action descriptions
29-
#macro ( indent )
30-
#set($action=$action.replaceAll("(?m)^ +"," "))
31-
#end
32-
#if ($release.getActions().size() == 0)
33-
No changes defined in this version.
34-
#else
35-
Changes in this version include:
36-
37-
#if ($release.getActions('add').size() !=0)
38-
New features:
39-
#foreach($actionItem in $release.getActions('add'))
28+
## set up indent sizes. Only change indent1
29+
## indent1 = CODEC-nnn:
30+
#set($indent1=" ")
31+
## indent2 allows for issue wrapper
32+
#set($indent2="$indent1 ")
33+
##
34+
#macro ( processaction )
4035
## Use replaceAll to fix up LF-only line ends on Windows.
4136
#set($action=$actionItem.getAction().replaceAll("\n","
4237
"))
43-
#indent()
38+
## Fix up indentation for multi-line action descriptions
39+
#set($action=$action.replaceAll("(?m)^ +",$indent2))
4440
#if ($actionItem.getIssue())
45-
#set($issue=$actionItem.getIssue())
41+
#set($issue="$actionItem.getIssue():")
42+
## Pad shorter issue numbers
43+
#if ($issue.length() < $indent1.length())#set ($issue="$issue ")#end
44+
#if ($issue.length() < $indent1.length())#set ($issue="$issue ")#end
4645
#else
47-
#set($issue="")
46+
#set($issue=$indent1)
4847
#end
4948
#if ($actionItem.getDueTo())
50-
#set($dueto=$actionItem.getDueTo())
49+
#set($dueto="Thanks to $actionItem.getDueTo(). ")
5150
#else
5251
#set($dueto="")
5352
#end
54-
o#if($!issue != "") $issue: #end ${action} #if($!dueto != "")Thanks to $dueto. #end
55-
53+
o $issue ${action} $dueto
54+
#set($action="")
5655
#set($issue="")
5756
#set($dueto="")
57+
#end
58+
##
59+
#if ($release.getActions().size() == 0)
60+
No changes defined in this version.
61+
#else
62+
Changes in this version include:
63+
64+
#if ($release.getActions('add').size() !=0)
65+
New features:
66+
#foreach($actionItem in $release.getActions('add'))
67+
#processaction()
5868
#end
5969
#end
6070

6171
#if ($release.getActions('fix').size() !=0)
6272
Fixed Bugs:
6373
#foreach($actionItem in $release.getActions('fix'))
64-
## Use replaceAll to fix up LF-only line ends on Windows.
65-
#set($action=$actionItem.getAction().replaceAll("\n","
66-
"))
67-
#indent()
68-
#if ($actionItem.getIssue())
69-
#set($issue=$actionItem.getIssue())
70-
#else
71-
#set($issue="")
72-
#end
73-
#if ($actionItem.getDueTo())
74-
#set($dueto=$actionItem.getDueTo())
75-
#else
76-
#set($dueto="")
77-
#end
78-
o#if($!issue != "") $issue: #end ${action} #if($!dueto != "")Thanks to $dueto. #end
79-
80-
#set($issue="")
81-
#set($dueto="")
74+
#processaction()
8275
#end
8376
#end
8477

8578
#if ($release.getActions('update').size() !=0)
8679
Changes:
8780
#foreach($actionItem in $release.getActions('update'))
88-
## Use replaceAll to fix up LF-only line ends on Windows.
89-
#set($action=$actionItem.getAction().replaceAll("\n","
90-
"))
91-
#indent()
92-
#if ($actionItem.getIssue())
93-
#set($issue=$actionItem.getIssue())
94-
#else
95-
#set($issue="")
96-
#end
97-
#if ($actionItem.getDueTo())
98-
#set($dueto=$actionItem.getDueTo())
99-
#else
100-
#set($dueto="")
101-
#end
102-
o#if($!issue != "") $issue: #end ${action} #if($!dueto != "")Thanks to $dueto. #end
103-
104-
#set($issue="")
105-
#set($dueto="")
81+
#processaction()
10682
#end
10783
#end
10884

10985
#if ($release.getActions('remove').size() !=0)
11086
Removed:
11187
#foreach($actionItem in $release.getActions('remove'))
112-
## Use replaceAll to fix up LF-only line ends on Windows.
113-
#set($action=$actionItem.getAction().replaceAll("\n","
114-
"))
115-
#indent()
116-
#if ($actionItem.getIssue())
117-
#set($issue=$actionItem.getIssue())
118-
#else
119-
#set($issue="")
120-
#end
121-
#if ($actionItem.getDueTo())
122-
#set($dueto=$actionItem.getDueTo())
123-
#else
124-
#set($dueto="")
125-
#end
126-
o#if($!issue != "") $issue. #end ${action} #if($!dueto != "")Thanks to $dueto. #end
127-
128-
#set($issue="")
129-
#set($dueto="")
88+
#processaction()
13089
#end
13190
#end
13291
## End of main loop

0 commit comments

Comments
 (0)