forked from DCC-EX/mkdocs-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull-exrail.awk
More file actions
38 lines (31 loc) · 904 Bytes
/
pull-exrail.awk
File metadata and controls
38 lines (31 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Print lines that start with optional whitespace followed by "#define"
# Usage: awk -f pull-exrail.awk inputfile > outputfile
/^[[:space:]]*#define/ {
line = $0
sub(/^[[:space:]]*#define[[:space:]]*/ , "" , line)
print "\n## " line "\n"
next
}
# Match lines starting with optional space then "///brief" and remove the prefix
/^[[:space:]]*\/\/\/brief/ {
line = $0
sub(/^[[:space:]]*\/\/\/brief[[:space:]]*/ , "" , line)
print line
print ""
next
}
# Match lines starting with optional space then "///param" and remove the prefix
/^[[:space:]]*\/\/\/param/ {
line = $0
sub(/^[[:space:]]*\/\/\/param[[:space:]]*/ , "- " , line)
print line
next
}
# Copy any other lines starting with "///" removing the "///" prefix
/^[[:space:]]*\/\/\// {
line = $0
sub(/^[[:space:]]*\/\/\/[[:space:]]*/ , "" , line)
print line
print ""
next
}