Skip to content

Commit

Permalink
transformed callouts to enable easy copy/pasting from code tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuppitz committed Jan 24, 2018
1 parent 9c7b5fc commit 6c0b14c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/preprocessor/awk/tabify.awk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ function print_tabs(next_id, tabs, blocks) {
print "++++\n"
}

function transform_callouts(code, c) {
return gensub(/\s*((<[0-9]+>\s*)*<[0-9]+>)\s*\n/, " " c c " \\1\\2\n", "g", code)
}

BEGIN {
id_part=systime()
status = 0
Expand Down Expand Up @@ -98,7 +102,15 @@ BEGIN {
i++
}
tabs[i] = lang
blocks[i] = "[source," lang "]" code "\n" $0 "\n"
switch (lang) {
case "python":
c = "#"
break
default:
c = "//"
break
}
blocks[i] = "[source," lang "]" transform_callouts(code, c) "\n" $0 "\n"
}
} else {
if (status == 0) print
Expand Down

0 comments on commit 6c0b14c

Please sign in to comment.