Blob


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