~ecs/ecs.d2evs.net

ecs.d2evs.net/title.awk -rwxr-xr-x 271 bytes
c21ce371Eyal Sawady oglaf.sh: initial commit a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/awk -f
BEGIN { mode="normal" }
{
	if (mode == "normal") {
		if ($0 ~ /^#[^#]/) {
			sub(/^#[ \t]*/, "");
			print $0;
			exit 0;
		} else if ($0 ~ /^```/) {
			mode="preformatted";
		}
	} else if (mode == "preformatted" && $0 ~ /^```/) {
		mode="normal";
	}
}