Blob


1 #!/usr/bin/awk -f
2 #
3 # gc - gemini-fy code
5 /^\t/ {
6 if (!pre) {
7 pre = 1
8 print "```"
9 }
10 emptylines()
11 print substr($0, 2)
12 next
13 }
15 /^$/ {
16 if (pre)
17 empty++
18 else
19 print $0
20 next
21 }
23 // {
24 if (pre) {
25 pre = 0
26 print "```"
27 }
28 emptylines()
29 print $0
30 }
32 END { if (pre) print "```" }
34 function emptylines() {
35 for (i = 0; i < empty; i++)
36 print ""
37 empty = 0
38 }