forked from WoozyMasta/codex-switch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-notes.awk
More file actions
56 lines (46 loc) · 784 Bytes
/
release-notes.awk
File metadata and controls
56 lines (46 loc) · 784 Bytes
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
# Build release notes for the latest version section in CHANGELOG.md.
# - Skips leading HTML comment blocks (Unreleased template, etc.).
# - Extracts first "## [x.y.z]" section.
# - Joins wrapped bullet continuation lines into one line.
/^<!--/,/^-->/ { next }
/^## \[[0-9]+\.[0-9]+\.[0-9]+\]/ {
if (found) { exit }
found = 1
next
}
found {
gsub(/\r$/, "", $0)
if (/^## \[/) { exit }
if (/^$/) {
flush()
print
next
}
if (/^\* / || /^- /) {
flush()
buf = $0
next
}
if (/^###/ || /^\[/) {
flush()
print
next
}
sub(/^[ \t]+/, "")
sub(/[ \t]+$/, "")
if (buf != "") {
buf = buf " " $0
} else {
buf = $0
}
next
}
function flush() {
if (buf != "") {
print buf
buf = ""
}
}
END {
flush()
}