7
|
1 BEGIN {
|
|
2 # some initialization variables
|
|
3 asciiart="no";
|
|
4 wasset="no";
|
|
5 lineset=0;
|
|
6 sample="no";
|
|
7 while ( getline ti <"tags.ref" > 0 ) {
|
|
8 nf=split(ti,tag," ");
|
|
9 tagkey[tag[1]]="yes";tagref[tag[1]]=tag[2];
|
|
10 }
|
|
11 skip_word["and"]="yes";
|
|
12 skip_word["backspace"]="yes";
|
|
13 skip_word["beep"]="yes";
|
|
14 skip_word["bugs"]="yes";
|
|
15 skip_word["da"]="yes";
|
|
16 skip_word["end"]="yes";
|
|
17 skip_word["ftp"]="yes";
|
|
18 skip_word["go"]="yes";
|
|
19 skip_word["help"]="yes";
|
|
20 skip_word["home"]="yes";
|
|
21 skip_word["news"]="yes";
|
|
22 skip_word["index"]="yes";
|
|
23 skip_word["insert"]="yes";
|
|
24 skip_word["into"]="yes";
|
|
25 skip_word["put"]="yes";
|
|
26 skip_word["reference"]="yes";
|
|
27 skip_word["section"]="yes";
|
|
28 skip_word["space"]="yes";
|
|
29 skip_word["starting"]="yes";
|
|
30 skip_word["toggle"]="yes";
|
|
31 skip_word["various"]="yes";
|
|
32 skip_word["version"]="yes";
|
|
33 skip_word["is"]="yes";
|
|
34 }
|
|
35 #
|
|
36 # protect special chars
|
|
37 #
|
|
38 /[><&á]/ {gsub(/&/,"\\&");gsub(/>/,"\\>");gsub(/</,"\\<");gsub("á","\\á");}
|
|
39 #
|
|
40 # end of sample lines by non-blank in first column
|
|
41 #
|
|
42 sample == "yes" && substr($0,1,4) == "<" { sample = "no"; gsub(/^</, " "); }
|
|
43 sample == "yes" && substr($0,1,1) != " " && substr($0,1,1) != " " && length($0) > 0 { sample = "no" }
|
|
44 #
|
|
45 # sample lines printed bold unless empty...
|
|
46 #
|
|
47 sample == "yes" && $0 =="" { print ""; next; }
|
|
48 sample == "yes" && $0 !="" { print "<B>" $0 "</B>"; next; }
|
|
49 #
|
|
50 # start of sample lines in next line
|
|
51 #
|
|
52 $0 == ">" { sample = "yes"; print ""; next; }
|
|
53 substr($0,length($0)-4,5) == " >" { sample = "yes"; gsub(/ >$/, ""); }
|
|
54 #
|
|
55 # header lines printed bold, colored
|
|
56 #
|
|
57 substr($0,length($0),1) == "~" { print "<B><FONT COLOR=\"PURPLE\">" substr($0,1,length($0)-1) "</FONT></B>"; next; }
|
|
58 #
|
|
59 #ad hoc code
|
|
60 #
|
|
61 /^"\|\& / {gsub(/\|/,"\\|"); }
|
|
62 / = b / {gsub(/ b /," \\b "); }
|
|
63 #
|
|
64 # one letter tag
|
|
65 #
|
|
66 /[ ]\*.\*[ ]/ {gsub(/\*/,"ZWWZ"); }
|
|
67 #
|
|
68 # isolated "*"
|
|
69 #
|
|
70 /[ ]\*[ ]/ {gsub(/ \* /," \\* ");
|
|
71 gsub(/ \* /," \\* ");
|
|
72 gsub(/ \* /," \\* ");
|
|
73 gsub(/ \* /," \\* "); }
|
|
74 #
|
|
75 # tag start
|
|
76 #
|
|
77 /[ ]\*[^ ]/ {gsub(/ \*/," ZWWZ");gsub(/ \*/," ZWWZ");}
|
|
78 /^\*[^ ]/ {gsub(/^\*/,"ZWWZ");}
|
|
79 #
|
|
80 # tag end
|
|
81 #
|
|
82 /[^ ]\*$/ {gsub(/\*$/,"ZWWZ");}
|
|
83 /[^ \/ ]\*[ ]/ {gsub(/\*/,"ZWWZ");}
|
|
84 #
|
|
85 # isolated "|"
|
|
86 #
|
|
87 /[ ]\|[ ]/ {gsub(/ \| /," \\| ");
|
|
88 gsub(/ \| /," \\| ");
|
|
89 gsub(/ \| /," \\| ");
|
|
90 gsub(/ \| /," \\| "); }
|
|
91 /'\|'/ { gsub(/'\|'/,"'\\|'"); }
|
|
92 /\^V\|/ {gsub(/\^V\|/,"^V\\|");}
|
|
93 / \\\| / {gsub(/\|/,"\\|");}
|
|
94 #
|
|
95 # one letter pipes and "||" false pipe (digraphs)
|
|
96 #
|
|
97 /[ ]\|.\|[ ]/ && asciiart == "no" {gsub(/\|/,"YXXY"); }
|
|
98 /^\|.\|[ ]/ {gsub(/\|/,"YXXY"); }
|
|
99 /\|\|/ {gsub(/\|\|/,"\\|\\|"); }
|
|
100 /^shellpipe/ {gsub(/\|/,"\\|"); }
|
|
101 #
|
|
102 # pipe start
|
|
103 #
|
|
104 /[ ]\|[^ ]/ && asciiart == "no" {gsub(/ \|/," YXXY");
|
|
105 gsub(/ \|/," YXXY");}
|
|
106 /^\|[^ ]/ {gsub(/^\|/,"YXXY");}
|
|
107 #
|
|
108 # pipe end
|
|
109 #
|
|
110 /[^ ]\|$/ && asciiart == "no" {gsub(/\|$/,"YXXY");}
|
|
111 /[^ ]\|[s ,.); ]/ && asciiart == "no" {gsub(/\|/,"YXXY");}
|
|
112 /[^ ]\|]/ && asciiart == "no" {gsub(/\|/,"YXXY");}
|
|
113 #
|
|
114 # various
|
|
115 #
|
|
116 /'"/ {gsub(/'"/,"\\'\\"'");}
|
|
117 /"/ {gsub(/"/,"\\"");}
|
|
118 /%/ {gsub(/%/,"\\%");}
|
|
119
|
|
120 NR == 1 { nf=split(FILENAME,f,".")
|
|
121 print "<HTML>";
|
|
122
|
|
123 print "<HEAD>"
|
|
124 if ( FILENAME == "mbyte.txt" ) {
|
|
125 # needs utf-8 as uses many languages
|
|
126 print "<META HTTP-EQUIV=\"Content-type\" content=\"text/html; charset=UTF-8\">";
|
|
127 } else {
|
|
128 # common case - Latin1
|
|
129 print "<META HTTP-EQUIV=\"Content-type\" content=\"text/html; charset=ISO-8859-1\">";
|
|
130 }
|
|
131 print "<TITLE>Vim documentation: " f[1] "</TITLE>";
|
|
132 print "</HEAD>";
|
|
133
|
|
134 print "<BODY BGCOLOR=\"#ffffff\">";
|
|
135 print "<H1>Vim documentation: " f[1] "</H1>";
|
|
136 print "<A NAME=\"top\"></A>";
|
|
137 if ( FILENAME != "help.txt" ) {
|
|
138 print "<A HREF=\"help.html\">main help file</A>\n";
|
|
139 }
|
|
140 print "<HR>";
|
|
141 print "<PRE>";
|
|
142 filename=f[1]".html";
|
|
143 }
|
|
144
|
|
145 # set to a low value to test for few lines of text
|
|
146 # NR == 99999 { exit; }
|
|
147
|
|
148 # ignore underlines and tags
|
|
149 substr($0,1,5) == " vim:" { next; }
|
|
150 substr($0,1,4) == "vim:" { next; }
|
|
151 # keep just whole lines of "-", "="
|
|
152 substr($0,1,3) == "===" && substr($0,75,1) != "=" { next; }
|
|
153 substr($0,1,3) == "---" && substr($0,75,1) != "-" { next; }
|
|
154
|
|
155 {
|
|
156 nstar = split($0,s,"ZWWZ");
|
|
157 for ( i=2 ; i <= nstar ; i=i+2 ) {
|
|
158 nbla=split(s[i],blata,"[ ]");
|
|
159 if ( nbla > 1 ) {
|
|
160 gsub("ZWWZ","*");
|
|
161 nstar = split($0,s,"ZWWZ");
|
|
162 }
|
|
163 }
|
|
164 npipe = split($0,p,"YXXY");
|
|
165 for ( i=2 ; i <= npipe ; i=i+2 ) {
|
|
166 nbla=split(p[i],blata,"[ ]");
|
|
167 if ( nbla > 1 ) {
|
|
168 gsub("YXXY","|");
|
|
169 ntabs = split($0,p,"YXXY");
|
|
170 }
|
|
171 }
|
|
172 }
|
|
173
|
|
174
|
|
175 FILENAME == "gui.txt" && asciiart == "no" \
|
|
176 && $0 ~ /\+----/ && $0 ~ /----\+/ {
|
|
177 asciiart= "yes";
|
|
178 asciicnt=0;
|
|
179 }
|
|
180
|
|
181 FILENAME == "quotes.txt" && asciiart == "no" \
|
|
182 && $0 ~ /In summary:/ {
|
|
183 asciiart= "yes";
|
|
184 asciicnt=0;
|
|
185 }
|
|
186
|
|
187 FILENAME == "usr_20.txt" && asciiart == "no" \
|
|
188 && $0 ~ /an empty line at the end:/ {
|
|
189 asciiart= "yes";
|
|
190 asciicnt=0;
|
|
191 }
|
|
192
|
|
193 asciiart == "yes" && $0=="" { asciicnt++; }
|
|
194
|
|
195 asciiart == "yes" && asciicnt == 2 { asciiart = "no"; }
|
|
196
|
|
197 asciiart == "yes" { npipe = 1; }
|
|
198 # { print NR " <=> " asciiart; }
|
|
199
|
|
200 #
|
|
201 # line contains "*"
|
|
202 #
|
|
203 nstar > 2 && npipe < 3 {
|
|
204 printf("\n");
|
|
205 for ( i=1; i <= nstar ; i=i+2 ) {
|
|
206 this=s[i];
|
|
207 put_this();
|
|
208 ii=i+1;
|
|
209 nbla = split(s[ii],blata," ");
|
|
210 if ( ii <= nstar ) {
|
|
211 if ( nbla == 1 && substr(s[ii],length(s[ii]),1) != " " ) {
|
|
212 printf("*<A NAME=\"%s\"></A>",s[ii]);
|
|
213 printf("<B>%s</B>*",s[ii]);
|
|
214 } else {
|
|
215 printf("*%s*",s[ii]);
|
|
216 }
|
|
217 }
|
|
218 }
|
|
219 printf("\n");
|
|
220 next;
|
|
221 }
|
|
222 #
|
|
223 # line contains "|"
|
|
224 #
|
|
225 npipe > 2 && nstar < 3 {
|
|
226 if ( npipe%2 == 0 ) {
|
|
227 for ( i=1; i < npipe ; i++ ) {
|
|
228 gsub("ZWWZ","*",p[i]);
|
|
229 printf("%s|",p[i]);
|
|
230 }
|
|
231 printf("%s\n",p[npipe]);
|
|
232 next;
|
|
233 }
|
|
234 for ( i=1; i <= npipe ; i++ )
|
|
235 {
|
|
236 if ( i % 2 == 1 ) {
|
|
237 gsub("ZWWZ","*",p[i]);
|
|
238 this=p[i];
|
|
239 put_this();
|
|
240 }
|
|
241 else {
|
|
242 nfn=split(p[i],f,".");
|
|
243 if ( nfn == 1 || f[2] == "" || f[1] == "" || length(f[2]) < 3 ) {
|
|
244 find_tag1();
|
|
245 }
|
|
246 else {
|
|
247 printf "|<A HREF=\"" f[1] ".html\">" p[i] "</A>|";
|
|
248 }
|
|
249 }
|
|
250 }
|
|
251 printf("\n");
|
|
252 next;
|
|
253 }
|
|
254 #
|
|
255 # line contains both "|" and "*"
|
|
256 #
|
|
257 npipe > 2 && nstar > 2 {
|
|
258 printf("\n");
|
|
259 for ( j=1; j <= nstar ; j=j+2 ) {
|
|
260 npipe = split(s[j],p,"YXXY");
|
|
261 if ( npipe > 1 ) {
|
|
262 for ( np=1; np<=npipe; np=np+2 ) {
|
|
263 this=p[np];
|
|
264 put_this();
|
|
265 i=np+1;find_tag1();
|
|
266 }
|
|
267 } else {
|
|
268 this=s[j];
|
|
269 put_this();
|
|
270 }
|
|
271 jj=j+1;
|
|
272 nbla = split(s[jj],blata," ");
|
|
273 if ( jj <= nstar && nbla == 1 && s[jj] != "" ) {
|
|
274 printf("*<A NAME=\"%s\"></A>",s[jj]);
|
|
275 printf("<B>%s</B>*",s[jj]);
|
|
276 } else {
|
|
277 if ( s[jj] != "" ) {
|
|
278 printf("*%s*",s[jj]);
|
|
279 }
|
|
280 }
|
|
281 }
|
|
282 printf("\n");
|
|
283 next;
|
|
284 }
|
|
285 #
|
|
286 # line contains e-mail address john.doe@some.place.edu
|
|
287 #
|
|
288 $0 ~ /@/ && $0 ~ /[a-zA-Z0-9]@[a-z]/ \
|
|
289 {
|
|
290 nemail=split($0,em," ");
|
|
291 if ( substr($0,1,1) == " " ) { printf(" "); }
|
|
292 for ( i=1; i <= nemail; i++ ) {
|
|
293 if ( em[i] ~ /@/ ) {
|
|
294 if ( substr(em[i],2,3) == "lt;" && substr(em[i],length(em[i])-2,3) == "gt;" ) {
|
|
295 mailaddr=substr(em[i],5,length(em[i])-8);
|
|
296 printf("<A HREF=\"mailto:%s\"><%s></A> ",mailaddr,mailaddr);
|
|
297 } else {
|
|
298 if ( substr(em[i],2,3) == "lt;" && substr(em[i],length(em[i])-3,3) == "gt;" ) {
|
|
299 mailaddr=substr(em[i],5,length(em[i])-9);
|
|
300 printf("<A HREF=\"mailto:%s\"><%s></A>%s ",mailaddr,mailaddr,substr(em[i],length(em[i]),1));
|
|
301 } else {
|
|
302 printf("<A HREF=\"mailto:%s\">%s</A> ",em[i],em[i]);
|
|
303 }
|
|
304 }
|
|
305 } else {
|
|
306 printf("%s ",em[i]);
|
|
307 }
|
|
308 }
|
|
309 #print "*** " NR " " FILENAME " - possible mail ref";
|
|
310 printf("\n");
|
|
311 next;
|
|
312 }
|
|
313 #
|
|
314 # line contains http / ftp reference
|
|
315 #
|
|
316 $0 ~ /http:\/\// || $0 ~ /ftp:\/\// {
|
|
317 gsub("URL:","");
|
|
318 gsub("<","");
|
|
319 gsub(">","");
|
|
320 gsub("\\(","");
|
|
321 gsub("\\)","");
|
|
322 nemail=split($0,em," ");
|
|
323 for ( i=1; i <= nemail; i++ ) {
|
|
324 if ( substr(em[i],1,5) == "http:" ||
|
|
325 substr(em[i],1,4) == "ftp:" ) {
|
|
326 if ( substr(em[i],length(em[i]),1) != "." ) {
|
|
327 printf(" <A HREF=\"%s\">%s</A>",em[i],em[i]);
|
|
328 } else {
|
|
329 em[i]=substr(em[i],1,length(em[i])-1);
|
|
330 printf(" <A HREF=\"%s\">%s</A>.",em[i],em[i]);
|
|
331 }
|
|
332 } else {
|
|
333 printf(" %s",em[i]);
|
|
334 }
|
|
335 }
|
|
336 #print "*** " NR " " FILENAME " - possible http ref";
|
|
337 printf("\n");
|
|
338 next;
|
|
339 }
|
|
340 #
|
|
341 # some lines contains just one "almost regular" "*"...
|
|
342 #
|
|
343 nstar == 2 {
|
|
344 this=s[1];
|
|
345 put_this();
|
|
346 printf("*");
|
|
347 this=s[2];
|
|
348 put_this();
|
|
349 printf("\n");
|
|
350 next;
|
|
351 }
|
|
352 #
|
|
353 # regular line
|
|
354 #
|
|
355 { ntabs = split($0,tb," ");
|
|
356 for ( i=1; i < ntabs ; i++) {
|
|
357 this=tb[i];
|
|
358 put_this();
|
|
359 printf(" ");
|
|
360 }
|
|
361 this=tb[ntabs];
|
|
362 put_this();
|
|
363 printf("\n");
|
|
364 }
|
|
365
|
|
366
|
|
367 asciiart == "yes" && $0 ~ /\+-\+--/ \
|
|
368 && $0 ~ "scrollbar" { asciiart = "no"; }
|
|
369
|
|
370 END {
|
|
371 topback();
|
|
372 print "</PRE>\n</BODY>\n\n\n</HTML>"; }
|
|
373
|
|
374 #
|
|
375 # as main we keep index.txt (by default)
|
|
376 # other candidate, help.txt
|
|
377 #
|
|
378 function topback () {
|
|
379 if ( FILENAME != "tags" ) {
|
|
380 if ( FILENAME != "help.txt" ) {
|
|
381 printf("<A HREF=\"#top\">top</A> - ");
|
|
382 printf("<A HREF=\"help.html\">main help file</A>\n");
|
|
383 } else {
|
|
384 printf("<A HREF=\"#top\">top</A>\n");
|
|
385 }
|
|
386 }
|
|
387 }
|
|
388
|
|
389 function find_tag1() {
|
|
390 if ( p[i] == "" ) { return; }
|
|
391 if ( tagkey[p[i]] == "yes" ) {
|
|
392 which=tagref[p[i]];
|
|
393 put_href();
|
|
394 return;
|
|
395 }
|
|
396 # if not found, then we have a problem
|
|
397 print "============================================" >>"errors.log";
|
|
398 print FILENAME ", line " NR ", pointer: >>" p[i] "<<" >>"errors.log";
|
|
399 print $0 >>"errors.log";
|
|
400 which="intro.html";
|
|
401 put_href();
|
|
402 }
|
|
403
|
|
404 function see_tag() {
|
|
405 # ad-hoc code:
|
|
406 if ( atag == "\"--" || atag == "--\"" ) { return; }
|
|
407 if_already();
|
|
408 if ( already == "yes" ) {
|
|
409 printf("%s",aword);
|
|
410 return;
|
|
411 }
|
|
412 allow_one_char="no";
|
|
413 find_tag2();
|
|
414 if ( done == "yes" ) { return; }
|
|
415 rightchar=substr(atag,length(atag),1);
|
|
416 if ( rightchar == "." \
|
|
417 || rightchar == "," \
|
|
418 || rightchar == ":" \
|
|
419 || rightchar == ";" \
|
|
420 || rightchar == "!" \
|
|
421 || rightchar == "?" \
|
|
422 || rightchar == ")" ) {
|
|
423 atag=substr(atag,1,length(atag)-1);
|
|
424 if_already();
|
|
425 if ( already == "yes" ) {
|
|
426 printf("%s",aword);
|
|
427 return;
|
|
428 }
|
|
429 find_tag2();
|
|
430 if ( done == "yes" ) { printf("%s",rightchar);return; }
|
|
431 leftchar=substr(atag,1,1);
|
|
432 lastbut1=substr(atag,length(atag),1);
|
|
433 if ( leftchar == "'" && lastbut1 == "'" ) {
|
|
434 allow_one_char="yes";
|
|
435 atag=substr(atag,2,length(atag)-2);
|
|
436 if_already();
|
|
437 if ( already == "yes" ) {
|
|
438 printf("%s",aword);
|
|
439 return;
|
|
440 }
|
|
441 printf("%s",leftchar);
|
|
442 aword=substr(atag,1,length(atag))""lastbut1""rightchar;
|
|
443 find_tag2();
|
|
444 if ( done == "yes" ) { printf("%s%s",lastbut1,rightchar);return; }
|
|
445 }
|
|
446 }
|
|
447 atag=aword;
|
|
448 leftchar=substr(atag,1,1);
|
|
449 if ( leftchar == "'" && rightchar == "'" ) {
|
|
450 allow_one_char="yes";
|
|
451 atag=substr(atag,2,length(atag)-2);
|
|
452 if ( atag == "<" ) { printf(" |%s|%s| ",atag,p[2]); }
|
|
453 if_already();
|
|
454 if ( already == "yes" ) {
|
|
455 printf("%s",aword);
|
|
456 return;
|
|
457 }
|
|
458 printf("%s",leftchar);
|
|
459 find_tag2();
|
|
460 if ( done == "yes" ) { printf("%s",rightchar);return; }
|
|
461 printf("%s%s",atag,rightchar);
|
|
462 return;
|
|
463 }
|
|
464 last2=substr(atag,length(atag)-1,2);
|
|
465 first2=substr(atag,1,2);
|
|
466 if ( first2 == "('" && last2 == "')" ) {
|
|
467 allow_one_char="yes";
|
|
468 atag=substr(atag,3,length(atag)-4);
|
|
469 if_already();
|
|
470 if ( already == "yes" ) {
|
|
471 printf("%s",aword);
|
|
472 return;
|
|
473 }
|
|
474 printf("%s",first2);
|
|
475 find_tag2();
|
|
476 if ( done == "yes" ) { printf("%s",last2);return; }
|
|
477 printf("%s%s",atag,last2);
|
|
478 return;
|
|
479 }
|
|
480 if ( last2 == ".)" ) {
|
|
481 atag=substr(atag,1,length(atag)-2);
|
|
482 if_already();
|
|
483 if ( already == "yes" ) {
|
|
484 printf("%s",aword);
|
|
485 return;
|
|
486 }
|
|
487 find_tag2();
|
|
488 if ( done == "yes" ) { printf("%s",last2);return; }
|
|
489 printf("%s%s",atag,last2);
|
|
490 return;
|
|
491 }
|
|
492 if ( last2 == ")." ) {
|
|
493 atag=substr(atag,1,length(atag)-2);
|
|
494 find_tag2();
|
|
495 if_already();
|
|
496 if ( already == "yes" ) {
|
|
497 printf("%s",aword);
|
|
498 return;
|
|
499 }
|
|
500 if ( done == "yes" ) { printf("%s",last2);return; }
|
|
501 printf("%s%s",atag,last2);
|
|
502 return;
|
|
503 }
|
|
504 first6=substr(atag,1,6);
|
|
505 last6=substr(atag,length(atag)-5,6);
|
|
506 if ( last6 == atag ) {
|
|
507 printf("%s",aword);
|
|
508 return;
|
|
509 }
|
|
510 last6of7=substr(atag,length(atag)-6,6);
|
|
511 if ( first6 == """ && last6of7 == """ && length(atag) > 12 ) {
|
|
512 allow_one_char="yes";
|
|
513 atag=substr(atag,7,length(atag)-13);
|
|
514 if_already();
|
|
515 if ( already == "yes" ) {
|
|
516 printf("%s",aword);
|
|
517 return;
|
|
518 }
|
|
519 printf("%s",first6);
|
|
520 find_tag2();
|
|
521 if ( done == "yes" ) { printf(""%s",rightchar); return; }
|
|
522 printf("%s"%s",atag,rightchar);
|
|
523 return;
|
|
524 }
|
|
525 if ( first6 == """ && last6 != """ ) {
|
|
526 allow_one_char="yes";
|
|
527 atag=substr(atag,7,length(atag)-6);
|
|
528 if ( atag == "[" ) { printf(""%s",atag); return; }
|
|
529 if ( atag == "." ) { printf(""%s",atag); return; }
|
|
530 if ( atag == ":" ) { printf(""%s",atag); return; }
|
|
531 if ( atag == "a" ) { printf(""%s",atag); return; }
|
|
532 if ( atag == "A" ) { printf(""%s",atag); return; }
|
|
533 if ( atag == "g" ) { printf(""%s",atag); return; }
|
|
534 if_already();
|
|
535 if ( already == "yes" ) {
|
|
536 printf(""%s",atag);
|
|
537 return;
|
|
538 }
|
|
539 printf("%s",first6);
|
|
540 find_tag2();
|
|
541 if ( done == "yes" ) { return; }
|
|
542 printf("%s",atag);
|
|
543 return;
|
|
544 }
|
|
545 if ( last6 == """ && first6 == """ ) {
|
|
546 allow_one_char="yes";
|
|
547 atag=substr(atag,7,length(atag)-12);
|
|
548 if_already();
|
|
549 if ( already == "yes" ) {
|
|
550 printf("%s",aword);
|
|
551 return;
|
|
552 }
|
|
553 printf("%s",first6);
|
|
554 find_tag2();
|
|
555 if ( done == "yes" ) { printf("%s",last6);return; }
|
|
556 printf("%s%s",atag,last6);
|
|
557 return;
|
|
558 }
|
|
559 last6of7=substr(atag,length(atag)-6,6);
|
|
560 if ( last6of7 == """ && first6 == """ ) {
|
|
561 allow_one_char="yes";
|
|
562 atag=substr(atag,7,length(atag)-13);
|
|
563 #printf("\natag=%s,aword=%s\n",atag,aword);
|
|
564 if_already();
|
|
565 if ( already == "yes" ) {
|
|
566 printf("%s",aword);
|
|
567 return;
|
|
568 }
|
|
569 printf("%s",first6);
|
|
570 find_tag2();
|
|
571 if ( done == "yes" ) { printf("%s%s",last6of7,rightchar);return; }
|
|
572 printf("%s%s%s",atag,last6of7,rightchar);
|
|
573 return;
|
|
574 }
|
|
575 printf("%s",aword);
|
|
576 }
|
|
577
|
|
578 function find_tag2() {
|
|
579 done="no";
|
|
580 # no blanks present in a tag...
|
|
581 ntags=split(atag,blata,"[ ]");
|
|
582 if ( ntags > 1 ) { return; }
|
|
583 if ( ( allow_one_char == "no" ) && \
|
|
584 ( index("!#$%\&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",atag) !=0 ) ) {
|
|
585 return;
|
|
586 }
|
|
587 if ( skip_word[atag] == "yes" ) { return; }
|
|
588 if ( wasset == "yes" && lineset == NR ) {
|
|
589 wasset="no";
|
|
590 see_opt();
|
|
591 if ( done_opt == "yes" ) {return;}
|
|
592 }
|
|
593 if ( wasset == "yes" && lineset != NR ) {
|
|
594 wasset="no";
|
|
595 }
|
|
596 if ( atag == ":set" ) {
|
|
597 wasset="yes";
|
|
598 lineset=NR;
|
|
599 }
|
|
600 if ( tagkey[atag] == "yes" ) {
|
|
601 which=tagref[atag];
|
|
602 put_href2();
|
|
603 done="yes";
|
|
604 }
|
|
605 }
|
|
606
|
|
607 function find_tag3() {
|
|
608 done="no";
|
|
609 # no blanks present in a tag...
|
|
610 ntags=split(btag,blata,"[ ]");
|
|
611 if ( ntags > 1 ) { return; }
|
|
612 if ( ( allow_one_char == "no" ) && \
|
|
613 ( index("!#$%\&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",btag) !=0 ) ) {
|
|
614 return;
|
|
615 }
|
|
616 if ( skip_word[btag] == "yes" ) { return; }
|
|
617 if ( tagkey[btag] == "yes" ) {
|
|
618 which=tagref[btag];
|
|
619 put_href3();
|
|
620 done="yes";
|
|
621 }
|
|
622 }
|
|
623
|
|
624 function put_href() {
|
|
625 if ( p[i] == "" ) { return; }
|
|
626 if ( which == FILENAME ) {
|
|
627 printf("|<A HREF=\"#%s\">%s</A>|",p[i],p[i]);
|
|
628 }
|
|
629 else {
|
|
630 nz=split(which,zz,".");
|
|
631 if ( zz[2] == "txt" || zz[1] == "tags" ) {
|
|
632 printf("|<A HREF=\"%s.html#%s\">%s</A>|",zz[1],p[i],p[i]);
|
|
633 }
|
|
634 else {
|
|
635 printf("|<A HREF=\"intro.html#%s\">%s</A>|",p[i],p[i]);
|
|
636 }
|
|
637 }
|
|
638 }
|
|
639
|
|
640 function put_href2() {
|
|
641 if ( atag == "" ) { return; }
|
|
642 if ( which == FILENAME ) {
|
|
643 printf("<A HREF=\"#%s\">%s</A>",atag,atag);
|
|
644 }
|
|
645 else {
|
|
646 nz=split(which,zz,".");
|
|
647 if ( zz[2] == "txt" || zz[1] == "tags" ) {
|
|
648 printf("<A HREF=\"%s.html#%s\">%s</A>",zz[1],atag,atag);
|
|
649 }
|
|
650 else {
|
|
651 printf("<A HREF=\"intro.html#%s\">%s</A>",atag,atag);
|
|
652 }
|
|
653 }
|
|
654 }
|
|
655
|
|
656 function put_href3() {
|
|
657 if ( btag == "" ) { return; }
|
|
658 if ( which == FILENAME ) {
|
|
659 printf("<A HREF=\"#%s\">%s</A>",btag,btag2);
|
|
660 }
|
|
661 else {
|
|
662 nz=split(which,zz,".");
|
|
663 if ( zz[2] == "txt" || zz[1] == "tags" ) {
|
|
664 printf("<A HREF=\"%s.html#%s\">%s</A>",zz[1],btag,btag2);
|
|
665 }
|
|
666 else {
|
|
667 printf("<A HREF=\"intro.html#%s\">%s</A>",btag,btag2);
|
|
668 }
|
|
669 }
|
|
670 }
|
|
671
|
|
672 function put_this() {
|
|
673 ntab=split(this,ta," ");
|
|
674 for ( nta=1 ; nta <= ntab ; nta++ ) {
|
|
675 ata=ta[nta];
|
|
676 lata=length(ata);
|
|
677 aword="";
|
|
678 for ( iata=1 ; iata <=lata ; iata++ ) {
|
|
679 achar=substr(ata,iata,1);
|
|
680 if ( achar != " " ) { aword=aword""achar; }
|
|
681 else {
|
|
682 if ( aword != "" ) { atag=aword;
|
|
683 see_tag();
|
|
684 aword="";
|
|
685 printf(" "); }
|
|
686 else {
|
|
687 printf(" ");
|
|
688 }
|
|
689 }
|
|
690 }
|
|
691 if ( aword != "" ) { atag=aword;
|
|
692 see_tag();
|
|
693 }
|
|
694 if ( nta != ntab ) { printf(" "); }
|
|
695 }
|
|
696 }
|
|
697
|
|
698 function if_already() {
|
|
699 already="no";
|
|
700 if ( npipe < 2 ) { return; }
|
|
701 if ( atag == ":au" && p[2] == ":autocmd" ) { already="yes";return; }
|
|
702 for ( npp=2 ; npp <= npipe ; npp=npp+2 ) {
|
|
703 if ( ( (index(p[npp],atag)) != 0 \
|
|
704 && length(p[npp]) > length(atag) \
|
|
705 && length(atag) >= 1 \
|
|
706 ) \
|
|
707 || (p[npp] == atag) \
|
|
708 ) {
|
|
709 # printf("p=|%s|,tag=|%s| ",p[npp],atag);
|
|
710 already="yes"; return; }
|
|
711 }
|
|
712 }
|
|
713
|
|
714 function see_opt() {
|
|
715 done_opt="no";
|
|
716 stag=atag;
|
|
717 nfields = split(atag,tae,"=");
|
|
718 if ( nfields > 1 ) {
|
|
719 btag="'"tae[1]"'";
|
|
720 btag2=tae[1];
|
|
721 find_tag3();
|
|
722 if (done == "yes") {
|
|
723 for ( ntae=2 ; ntae <= nfields ; ntae++ ) {
|
|
724 printf("=%s",tae[ntae]);
|
|
725 }
|
|
726 atag=stag;
|
|
727 done_opt="yes";
|
|
728 return;
|
|
729 }
|
|
730 btag=tae[1];
|
|
731 btag2=tae[1];
|
|
732 find_tag3();
|
|
733 if ( done=="yes" ) {
|
|
734 for ( ntae=2 ; ntae <= nfields ; ntae++ ) {
|
|
735 printf("=%s",tae[ntae]);
|
|
736 }
|
|
737 atag=stag;
|
|
738 done_opt="yes";
|
|
739 return;
|
|
740 }
|
|
741 }
|
|
742 nfields = split(atag,tae,""");
|
|
743 if ( nfields > 1 ) {
|
|
744 btag="'"tae[1]"'";
|
|
745 btag2=tae[1];
|
|
746 find_tag3();
|
|
747 if (done == "yes") {
|
|
748 printf(""");
|
|
749 atag=stag;
|
|
750 done_opt="yes";
|
|
751 return;
|
|
752 }
|
|
753 btag=tae[1];
|
|
754 btag2=tae[1];
|
|
755 find_tag3();
|
|
756 if (done == "yes") {
|
|
757 printf(""");
|
|
758 atag=stag;
|
|
759 done_opt="yes";
|
|
760 return;
|
|
761 }
|
|
762 }
|
|
763 btag="'"tae[1]"'";
|
|
764 btag2=tae[1];
|
|
765 find_tag3();
|
|
766 if (done == "yes") {
|
|
767 atag=stag;
|
|
768 done_opt="yes";
|
|
769 return;
|
|
770 }
|
|
771 btag=tae[1];
|
|
772 btag2=tae[1];
|
|
773 find_tag3();
|
|
774 if (done == "yes") {
|
|
775 atag=stag;
|
|
776 done_opt="yes";
|
|
777 return;
|
|
778 }
|
|
779 atag=stag;
|
|
780 }
|