forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slib-3.2.2-fix-texinfo.awk
123 lines (105 loc) · 1.58 KB
/
slib-3.2.2-fix-texinfo.awk
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Fixes Texinfo input to compile with Texinfo 5 or later
#
# Written by Sebastian Pipping <[email protected]>
# Licensed under CC0 1.0 Universal Public Domain Dedication
# https://creativecommons.org/publicdomain/zero/1.0/
#
# Version 0_p20150813_p0418
BEGIN {
inside_deffn = 0
inside_defmac = 0
inside_defop = 0
inside_deftp = 0
inside_defun = 0
}
/^@deffn / {
if (inside_deffn) {
print "@end deffn"
}
inside_deffn = 1
}
/^@deffnx / {
if (inside_deffn) {
print "@end deffn"
}
sub(/^@deffnx/, "@deffn")
inside_deffn = 1
}
/^@defmac / {
if (inside_defmac) {
print "@end defmac"
}
inside_defmac = 1
}
/^@defmacx / {
if (inside_defmac) {
print "@end defmac"
}
sub(/^@defmacx/, "@defmac")
inside_defmac = 1
}
/^@defop / {
if (inside_defop) {
print "@end defop"
}
inside_defop = 1
}
/^@defopx / {
if (inside_defop) {
print "@end defop"
}
sub(/^@defopx/, "@defop")
inside_defop = 1
}
/^@deftp / {
if (inside_deftp) {
print "@end deftp"
}
inside_deftp = 1
}
/^@deftpx / {
if (inside_deftp) {
print "@end deftp"
}
sub(/^@deftpx/, "@deftp")
inside_deftp = 1
}
/^@defun / {
if (inside_defun) {
print "@end defun"
}
inside_defun = 1
}
/^@defunx / {
if (inside_defun) {
print "@end defun"
}
sub(/^@defunx/, "@defun")
inside_defun = 1
}
/^@end deffn/ {
inside_deffn = 0
}
/^@end defmac/ {
inside_defmac = 0
}
/^@end defop/ {
inside_defop = 0
}
/^@end deftp/ {
inside_deftp = 0
}
/^@end defun/ {
inside_defun = 0
}
/^@subsubsection/ {
if (inside_deffn) {
print "@end deffn"
print $0
print "@deffn {Dummy} Dummy"
next
}
}
{
print
}