]> git.sur5r.net Git - glabels/blob - barcode-0.98/doc/manpager
Imported Upstream version 2.2.8
[glabels] / barcode-0.98 / doc / manpager
1 #! /usr/bin/awk -f
2 # Copyright (c) 1998-2001 Alessandro Rubini
3
4 BEGIN {IN=0}
5
6 /^%MANPAGE END/ {IN=0; next}
7 /^%MANPAGE/     {IN=1; USELP=NEEDLP=INTABLE=0; NAME=$2; next}
8 IN==0           {next}
9
10 /^%MSKIP/       {SKIP=1;next}
11 /^%M/           {SKIP=0}
12
13 /^@menu/        {SKIP=1;next}
14 /^@end menu/    {SKIP=0;next}
15
16 SKIP==1         {next}
17 /^%M$/          {next}
18 /^@ignore/      {next}
19 /^@end ign/     {next}
20
21 #now perform all the substitutions needed
22
23                 { gsub("^%M ?",""); }
24
25 # Use gensub for converting tags: itz Sep 30 1998
26 #
27 # However, the gensub function is gawk-specific, and we want things
28 # to work with original-awk too (for portability).
29 # Therefore, use a normal gsub, even though it's a subobptimal solution
30 # as it may step in extra braces. The good solution will be piping to sed,
31 # or match, extract subesxpression, replace, reinsert -- bleah...
32 # (ARub, Oct 10 2000)
33 /@b\{/ {
34   #$0 = gensub(/@b\{([^}]+)\}/, "\\\\fB\\1\\\\fP","g");
35   gsub("@b\{","\\fB");
36   gsub("\}","\\fP");
37
38
39 /@var\{/ {
40   #$0 = gensub(/@var\{([^}]+)\}/, "\\\\fI\\1\\\\fP","g");
41   gsub("@var\{","\\fB");
42   gsub("\}","\\fP");
43
44
45 /@(samp|code|file)\{/ {
46   #$0 = gensub(/@(samp|code|file)\{([^}]+)\}/, "`\\2'","g");
47   gsub("@(samp|code|file)\{","");
48   gsub("\}","");
49 }
50
51
52 /@xref\{.*\}\./ {
53   gsub(/@xref\{.*\}\./,"");
54 }
55
56 /@ref\{.*\}/ {
57   gsub("@ref\{","");
58   gsub("\}","");
59 }
60
61 /@\*/ {
62   gsub(/@\* */,"\n.br\n");
63 }
64
65 /@[a-z]+\{/      {
66                 gsub("@[a-z]+\\{","");
67                 gsub("}","");
68                 }
69
70 /^@table/       { TABLE=1; }
71 /^@itemize/     { TABLE=1; next}
72
73 /^@item/        {
74                 gsub("^@item *","");
75                 printf ".TP\n%s\n",$0 > NAME;
76                 NEEDLP=0; next;
77                 }
78
79 /^@end table/   {TABLE=0}
80 /^@end itemize/ {TABLE=0}
81
82 # discard other texinfo commands
83
84 /^@/            {next}
85
86 # manage comments and '%'
87
88 /^%/            {next}
89
90
91                 {
92                 gsub("[^\\\\]%.*$","");
93                 gsub("\\%","%");
94                 }
95
96 # remove leading blanks
97
98 /^[ \t]/        {gsub("^[ \t]*","");}
99
100 # put a .LP at blank lines
101
102 /^.nf/          {USELP=0}
103 /^.fi/          {USELP=1}
104
105 /^$/            {if (USELP) {NEEDLP++; next;} }
106
107
108 /./             { if (NEEDLP) { printf "\n.LP\n" > NAME; NEEDLP=0; } }
109
110 /^.TH/          {USELP=1}
111
112 # Escape single slashes (e.g. in documentation for `-l' command line option)
113
114                 {gsub("\\\\ ", "\\\\ ");}
115
116                 {gsub("~", "~~");}
117
118                 {print > NAME}
119
120