-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangelog.sh
65 lines (51 loc) · 2.12 KB
/
changelog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
SRC=$1
OUT=changelog.html
FEAT_PAT="s/.\t\w*\t\([^\t]*\)\t\(.*\)/<li>\2 - feature by <span class='author'>\1<\/span><\/li>/"
FIX_PAT="s/.\t\w*\t\([^\t]*\)\t\(.*\)/<li>\2 - fixed by <span class='author'>\1<\/span><\/li>/"
CHANGE_PAT="s/.\t\w*\t\(\w*\)\t\(.*\)/<li>\2 - changed by <span class='author'>\1<\/span><\/li>/"
HDR_PAT="s|.\t\(.*\)|<h2>\1</h2>|"
THNX_PAT="s|.\t\(\w*\)\t\(.*\)|<li><span class='author'>\1</span> \2</li>|"
if [ -f "$1" ]
then
echo Processing changelog $SRC...
sort $SRC | sed "s|\[\([^]]*\)\]|<a href='?\1'>\1</a>|g" > chlg_sorted
grep ^0. chlg_sorted | sed "$HDR_PAT" > $OUT
echo "<dl>" >> $OUT
echo "<dt>Major Features</dt><dd><ul>" >> $OUT
grep ^1.feature chlg_sorted | sed "$FEAT_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>Major Fixes</dt><dd><ul>" >> $OUT
grep ^1.fix chlg_sorted | sed "$FIX_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>Major Changes</dt><dd><ul>" >> $OUT
grep ^1.change chlg_sorted | sed "$CHANGE_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>For major contributions thanks goes to</dt><dd><ul>" >> $OUT
grep ^a. chlg_sorted | sed "$THNX_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>Credits to external contributors</dt><dd><ul>" >> $OUT
grep ^b. chlg_sorted | sed "$THNX_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>More Features</dt><dd><ul>" >> $OUT
grep ^2.feature chlg_sorted | sed "$FEAT_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>More Fixes</dt><dd><ul>" >> $OUT
grep ^2.fix chlg_sorted | sed "$FIX_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>More Changes</dt><dd><ul>" >> $OUT
grep ^2.change chlg_sorted | sed "$CHANGE_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>Minor Features</dt><dd><ul>" >> $OUT
grep ^3.feature chlg_sorted | sed "$FEAT_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>Minor Fixes</dt><dd><ul>" >> $OUT
grep ^3.fix chlg_sorted | sed "$FIX_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "<dt>Minor Changes</dt><dd><ul>" >> $OUT
grep ^3.change chlg_sorted | sed "$CHANGE_PAT" >> $OUT
echo "</ul></dd>" >> $OUT
echo "</dl>" >> $OUT
rm chlg_*
else
echo Give changelog filename as the first argument
fi