Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-description.awk
blob: b4fac0efcb513d350943d0bf824d840f9d0fac7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/p>.*/ {
	# Removes tags and bad characters
	gsub(/<[^>]*>/, "") ; gsub(/[^a-zA-Z0-9 ]/, "")
	# Trims leading and trailing spaces and tabs (if any)
	gsub(/^[ \t]*/, "") ; gsub(/[ \t]*$/, "")

	# Concatenates the current record to variable and shortens it,
	# when it gets too long
	desc = desc $0
	if (length(desc) >= 200) {
		desc = substr(desc, 1, 197) "..."
		exit
	}
}

END {
	print desc
}