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" ) {
|
790
|
138 print "<A HREF=\"index.html\">main help file</A>\n";
|
7
|
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 {
|
790
|
247 if ( f[1] == "index" ) {
|
|
248 printf "|<A HREF=\"vimindex.html\">" p[i] "</A>|";
|
|
249 } else {
|
|
250 if ( f[1] == "help" ) {
|
|
251 printf "|<A HREF=\"index.html\">" p[i] "</A>|";
|
|
252 } else {
|
7
|
253 printf "|<A HREF=\"" f[1] ".html\">" p[i] "</A>|";
|
790
|
254 }
|
|
255 }
|
7
|
256 }
|
|
257 }
|
|
258 }
|
|
259 printf("\n");
|
|
260 next;
|
|
261 }
|
|
262 #
|
|
263 # line contains both "|" and "*"
|
|
264 #
|
|
265 npipe > 2 && nstar > 2 {
|
|
266 printf("\n");
|
|
267 for ( j=1; j <= nstar ; j=j+2 ) {
|
|
268 npipe = split(s[j],p,"YXXY");
|
|
269 if ( npipe > 1 ) {
|
|
270 for ( np=1; np<=npipe; np=np+2 ) {
|
|
271 this=p[np];
|
|
272 put_this();
|
|
273 i=np+1;find_tag1();
|
|
274 }
|
|
275 } else {
|
|
276 this=s[j];
|
|
277 put_this();
|
|
278 }
|
|
279 jj=j+1;
|
|
280 nbla = split(s[jj],blata," ");
|
|
281 if ( jj <= nstar && nbla == 1 && s[jj] != "" ) {
|
|
282 printf("*<A NAME=\"%s\"></A>",s[jj]);
|
|
283 printf("<B>%s</B>*",s[jj]);
|
|
284 } else {
|
|
285 if ( s[jj] != "" ) {
|
|
286 printf("*%s*",s[jj]);
|
|
287 }
|
|
288 }
|
|
289 }
|
|
290 printf("\n");
|
|
291 next;
|
|
292 }
|
|
293 #
|
|
294 # line contains e-mail address john.doe@some.place.edu
|
|
295 #
|
|
296 $0 ~ /@/ && $0 ~ /[a-zA-Z0-9]@[a-z]/ \
|
|
297 {
|
|
298 nemail=split($0,em," ");
|
|
299 if ( substr($0,1,1) == " " ) { printf(" "); }
|
|
300 for ( i=1; i <= nemail; i++ ) {
|
|
301 if ( em[i] ~ /@/ ) {
|
|
302 if ( substr(em[i],2,3) == "lt;" && substr(em[i],length(em[i])-2,3) == "gt;" ) {
|
|
303 mailaddr=substr(em[i],5,length(em[i])-8);
|
|
304 printf("<A HREF=\"mailto:%s\"><%s></A> ",mailaddr,mailaddr);
|
|
305 } else {
|
|
306 if ( substr(em[i],2,3) == "lt;" && substr(em[i],length(em[i])-3,3) == "gt;" ) {
|
|
307 mailaddr=substr(em[i],5,length(em[i])-9);
|
|
308 printf("<A HREF=\"mailto:%s\"><%s></A>%s ",mailaddr,mailaddr,substr(em[i],length(em[i]),1));
|
|
309 } else {
|
|
310 printf("<A HREF=\"mailto:%s\">%s</A> ",em[i],em[i]);
|
|
311 }
|
|
312 }
|
|
313 } else {
|
|
314 printf("%s ",em[i]);
|
|
315 }
|
|
316 }
|
|
317 #print "*** " NR " " FILENAME " - possible mail ref";
|
|
318 printf("\n");
|
|
319 next;
|
|
320 }
|
|
321 #
|
|
322 # line contains http / ftp reference
|
|
323 #
|
|
324 $0 ~ /http:\/\// || $0 ~ /ftp:\/\// {
|
|
325 gsub("URL:","");
|
|
326 gsub("<","");
|
|
327 gsub(">","");
|
|
328 gsub("\\(","");
|
|
329 gsub("\\)","");
|
|
330 nemail=split($0,em," ");
|
|
331 for ( i=1; i <= nemail; i++ ) {
|
|
332 if ( substr(em[i],1,5) == "http:" ||
|
|
333 substr(em[i],1,4) == "ftp:" ) {
|
|
334 if ( substr(em[i],length(em[i]),1) != "." ) {
|
|
335 printf(" <A HREF=\"%s\">%s</A>",em[i],em[i]);
|
|
336 } else {
|
|
337 em[i]=substr(em[i],1,length(em[i])-1);
|
|
338 printf(" <A HREF=\"%s\">%s</A>.",em[i],em[i]);
|
|
339 }
|
|
340 } else {
|
|
341 printf(" %s",em[i]);
|
|
342 }
|
|
343 }
|
|
344 #print "*** " NR " " FILENAME " - possible http ref";
|
|
345 printf("\n");
|
|
346 next;
|
|
347 }
|
|
348 #
|
|
349 # some lines contains just one "almost regular" "*"...
|
|
350 #
|
|
351 nstar == 2 {
|
|
352 this=s[1];
|
|
353 put_this();
|
|
354 printf("*");
|
|
355 this=s[2];
|
|
356 put_this();
|
|
357 printf("\n");
|
|
358 next;
|
|
359 }
|
|
360 #
|
|
361 # regular line
|
|
362 #
|
|
363 { ntabs = split($0,tb," ");
|
|
364 for ( i=1; i < ntabs ; i++) {
|
|
365 this=tb[i];
|
|
366 put_this();
|
|
367 printf(" ");
|
|
368 }
|
|
369 this=tb[ntabs];
|
|
370 put_this();
|
|
371 printf("\n");
|
|
372 }
|
|
373
|
|
374
|
|
375 asciiart == "yes" && $0 ~ /\+-\+--/ \
|
|
376 && $0 ~ "scrollbar" { asciiart = "no"; }
|
|
377
|
|
378 END {
|
|
379 topback();
|
|
380 print "</PRE>\n</BODY>\n\n\n</HTML>"; }
|
|
381
|
|
382 #
|
|
383 # as main we keep index.txt (by default)
|
|
384 #
|
|
385 function topback () {
|
|
386 if ( FILENAME != "tags" ) {
|
|
387 if ( FILENAME != "help.txt" ) {
|
|
388 printf("<A HREF=\"#top\">top</A> - ");
|
790
|
389 printf("<A HREF=\"index.html\">main help file</A>\n");
|
7
|
390 } else {
|
|
391 printf("<A HREF=\"#top\">top</A>\n");
|
|
392 }
|
|
393 }
|
|
394 }
|
|
395
|
|
396 function find_tag1() {
|
|
397 if ( p[i] == "" ) { return; }
|
|
398 if ( tagkey[p[i]] == "yes" ) {
|
|
399 which=tagref[p[i]];
|
|
400 put_href();
|
|
401 return;
|
|
402 }
|
|
403 # if not found, then we have a problem
|
|
404 print "============================================" >>"errors.log";
|
|
405 print FILENAME ", line " NR ", pointer: >>" p[i] "<<" >>"errors.log";
|
|
406 print $0 >>"errors.log";
|
|
407 which="intro.html";
|
|
408 put_href();
|
|
409 }
|
|
410
|
|
411 function see_tag() {
|
|
412 # ad-hoc code:
|
|
413 if ( atag == "\"--" || atag == "--\"" ) { return; }
|
|
414 if_already();
|
|
415 if ( already == "yes" ) {
|
|
416 printf("%s",aword);
|
|
417 return;
|
|
418 }
|
|
419 allow_one_char="no";
|
|
420 find_tag2();
|
|
421 if ( done == "yes" ) { return; }
|
|
422 rightchar=substr(atag,length(atag),1);
|
|
423 if ( rightchar == "." \
|
|
424 || rightchar == "," \
|
|
425 || rightchar == ":" \
|
|
426 || rightchar == ";" \
|
|
427 || rightchar == "!" \
|
|
428 || rightchar == "?" \
|
|
429 || rightchar == ")" ) {
|
|
430 atag=substr(atag,1,length(atag)-1);
|
|
431 if_already();
|
|
432 if ( already == "yes" ) {
|
|
433 printf("%s",aword);
|
|
434 return;
|
|
435 }
|
|
436 find_tag2();
|
|
437 if ( done == "yes" ) { printf("%s",rightchar);return; }
|
|
438 leftchar=substr(atag,1,1);
|
|
439 lastbut1=substr(atag,length(atag),1);
|
|
440 if ( leftchar == "'" && lastbut1 == "'" ) {
|
|
441 allow_one_char="yes";
|
|
442 atag=substr(atag,2,length(atag)-2);
|
|
443 if_already();
|
|
444 if ( already == "yes" ) {
|
|
445 printf("%s",aword);
|
|
446 return;
|
|
447 }
|
|
448 printf("%s",leftchar);
|
|
449 aword=substr(atag,1,length(atag))""lastbut1""rightchar;
|
|
450 find_tag2();
|
|
451 if ( done == "yes" ) { printf("%s%s",lastbut1,rightchar);return; }
|
|
452 }
|
|
453 }
|
|
454 atag=aword;
|
|
455 leftchar=substr(atag,1,1);
|
|
456 if ( leftchar == "'" && rightchar == "'" ) {
|
|
457 allow_one_char="yes";
|
|
458 atag=substr(atag,2,length(atag)-2);
|
|
459 if ( atag == "<" ) { printf(" |%s|%s| ",atag,p[2]); }
|
|
460 if_already();
|
|
461 if ( already == "yes" ) {
|
|
462 printf("%s",aword);
|
|
463 return;
|
|
464 }
|
|
465 printf("%s",leftchar);
|
|
466 find_tag2();
|
|
467 if ( done == "yes" ) { printf("%s",rightchar);return; }
|
|
468 printf("%s%s",atag,rightchar);
|
|
469 return;
|
|
470 }
|
|
471 last2=substr(atag,length(atag)-1,2);
|
|
472 first2=substr(atag,1,2);
|
|
473 if ( first2 == "('" && last2 == "')" ) {
|
|
474 allow_one_char="yes";
|
|
475 atag=substr(atag,3,length(atag)-4);
|
|
476 if_already();
|
|
477 if ( already == "yes" ) {
|
|
478 printf("%s",aword);
|
|
479 return;
|
|
480 }
|
|
481 printf("%s",first2);
|
|
482 find_tag2();
|
|
483 if ( done == "yes" ) { printf("%s",last2);return; }
|
|
484 printf("%s%s",atag,last2);
|
|
485 return;
|
|
486 }
|
|
487 if ( last2 == ".)" ) {
|
|
488 atag=substr(atag,1,length(atag)-2);
|
|
489 if_already();
|
|
490 if ( already == "yes" ) {
|
|
491 printf("%s",aword);
|
|
492 return;
|
|
493 }
|
|
494 find_tag2();
|
|
495 if ( done == "yes" ) { printf("%s",last2);return; }
|
|
496 printf("%s%s",atag,last2);
|
|
497 return;
|
|
498 }
|
|
499 if ( last2 == ")." ) {
|
|
500 atag=substr(atag,1,length(atag)-2);
|
|
501 find_tag2();
|
|
502 if_already();
|
|
503 if ( already == "yes" ) {
|
|
504 printf("%s",aword);
|
|
505 return;
|
|
506 }
|
|
507 if ( done == "yes" ) { printf("%s",last2);return; }
|
|
508 printf("%s%s",atag,last2);
|
|
509 return;
|
|
510 }
|
|
511 first6=substr(atag,1,6);
|
|
512 last6=substr(atag,length(atag)-5,6);
|
|
513 if ( last6 == atag ) {
|
|
514 printf("%s",aword);
|
|
515 return;
|
|
516 }
|
|
517 last6of7=substr(atag,length(atag)-6,6);
|
|
518 if ( first6 == """ && last6of7 == """ && length(atag) > 12 ) {
|
|
519 allow_one_char="yes";
|
|
520 atag=substr(atag,7,length(atag)-13);
|
|
521 if_already();
|
|
522 if ( already == "yes" ) {
|
|
523 printf("%s",aword);
|
|
524 return;
|
|
525 }
|
|
526 printf("%s",first6);
|
|
527 find_tag2();
|
|
528 if ( done == "yes" ) { printf(""%s",rightchar); return; }
|
|
529 printf("%s"%s",atag,rightchar);
|
|
530 return;
|
|
531 }
|
|
532 if ( first6 == """ && last6 != """ ) {
|
|
533 allow_one_char="yes";
|
|
534 atag=substr(atag,7,length(atag)-6);
|
|
535 if ( atag == "[" ) { printf(""%s",atag); return; }
|
|
536 if ( atag == "." ) { printf(""%s",atag); return; }
|
|
537 if ( atag == ":" ) { printf(""%s",atag); return; }
|
|
538 if ( atag == "a" ) { printf(""%s",atag); return; }
|
|
539 if ( atag == "A" ) { printf(""%s",atag); return; }
|
|
540 if ( atag == "g" ) { printf(""%s",atag); return; }
|
|
541 if_already();
|
|
542 if ( already == "yes" ) {
|
|
543 printf(""%s",atag);
|
|
544 return;
|
|
545 }
|
|
546 printf("%s",first6);
|
|
547 find_tag2();
|
|
548 if ( done == "yes" ) { return; }
|
|
549 printf("%s",atag);
|
|
550 return;
|
|
551 }
|
|
552 if ( last6 == """ && first6 == """ ) {
|
|
553 allow_one_char="yes";
|
|
554 atag=substr(atag,7,length(atag)-12);
|
|
555 if_already();
|
|
556 if ( already == "yes" ) {
|
|
557 printf("%s",aword);
|
|
558 return;
|
|
559 }
|
|
560 printf("%s",first6);
|
|
561 find_tag2();
|
|
562 if ( done == "yes" ) { printf("%s",last6);return; }
|
|
563 printf("%s%s",atag,last6);
|
|
564 return;
|
|
565 }
|
|
566 last6of7=substr(atag,length(atag)-6,6);
|
|
567 if ( last6of7 == """ && first6 == """ ) {
|
|
568 allow_one_char="yes";
|
|
569 atag=substr(atag,7,length(atag)-13);
|
|
570 #printf("\natag=%s,aword=%s\n",atag,aword);
|
|
571 if_already();
|
|
572 if ( already == "yes" ) {
|
|
573 printf("%s",aword);
|
|
574 return;
|
|
575 }
|
|
576 printf("%s",first6);
|
|
577 find_tag2();
|
|
578 if ( done == "yes" ) { printf("%s%s",last6of7,rightchar);return; }
|
|
579 printf("%s%s%s",atag,last6of7,rightchar);
|
|
580 return;
|
|
581 }
|
|
582 printf("%s",aword);
|
|
583 }
|
|
584
|
|
585 function find_tag2() {
|
|
586 done="no";
|
|
587 # no blanks present in a tag...
|
|
588 ntags=split(atag,blata,"[ ]");
|
|
589 if ( ntags > 1 ) { return; }
|
|
590 if ( ( allow_one_char == "no" ) && \
|
694
|
591 ( index("!#$%&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",atag) !=0 ) ) {
|
7
|
592 return;
|
|
593 }
|
|
594 if ( skip_word[atag] == "yes" ) { return; }
|
|
595 if ( wasset == "yes" && lineset == NR ) {
|
|
596 wasset="no";
|
|
597 see_opt();
|
|
598 if ( done_opt == "yes" ) {return;}
|
|
599 }
|
|
600 if ( wasset == "yes" && lineset != NR ) {
|
|
601 wasset="no";
|
|
602 }
|
|
603 if ( atag == ":set" ) {
|
|
604 wasset="yes";
|
|
605 lineset=NR;
|
|
606 }
|
|
607 if ( tagkey[atag] == "yes" ) {
|
|
608 which=tagref[atag];
|
|
609 put_href2();
|
|
610 done="yes";
|
|
611 }
|
|
612 }
|
|
613
|
|
614 function find_tag3() {
|
|
615 done="no";
|
|
616 # no blanks present in a tag...
|
|
617 ntags=split(btag,blata,"[ ]");
|
|
618 if ( ntags > 1 ) { return; }
|
|
619 if ( ( allow_one_char == "no" ) && \
|
694
|
620 ( index("!#$%&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",btag) !=0 ) ) {
|
7
|
621 return;
|
|
622 }
|
|
623 if ( skip_word[btag] == "yes" ) { return; }
|
|
624 if ( tagkey[btag] == "yes" ) {
|
|
625 which=tagref[btag];
|
|
626 put_href3();
|
|
627 done="yes";
|
|
628 }
|
|
629 }
|
|
630
|
|
631 function put_href() {
|
|
632 if ( p[i] == "" ) { return; }
|
|
633 if ( which == FILENAME ) {
|
|
634 printf("|<A HREF=\"#%s\">%s</A>|",p[i],p[i]);
|
|
635 }
|
|
636 else {
|
|
637 nz=split(which,zz,".");
|
|
638 if ( zz[2] == "txt" || zz[1] == "tags" ) {
|
|
639 printf("|<A HREF=\"%s.html#%s\">%s</A>|",zz[1],p[i],p[i]);
|
|
640 }
|
|
641 else {
|
|
642 printf("|<A HREF=\"intro.html#%s\">%s</A>|",p[i],p[i]);
|
|
643 }
|
|
644 }
|
|
645 }
|
|
646
|
|
647 function put_href2() {
|
|
648 if ( atag == "" ) { return; }
|
|
649 if ( which == FILENAME ) {
|
|
650 printf("<A HREF=\"#%s\">%s</A>",atag,atag);
|
|
651 }
|
|
652 else {
|
|
653 nz=split(which,zz,".");
|
|
654 if ( zz[2] == "txt" || zz[1] == "tags" ) {
|
|
655 printf("<A HREF=\"%s.html#%s\">%s</A>",zz[1],atag,atag);
|
|
656 }
|
|
657 else {
|
|
658 printf("<A HREF=\"intro.html#%s\">%s</A>",atag,atag);
|
|
659 }
|
|
660 }
|
|
661 }
|
|
662
|
|
663 function put_href3() {
|
|
664 if ( btag == "" ) { return; }
|
|
665 if ( which == FILENAME ) {
|
|
666 printf("<A HREF=\"#%s\">%s</A>",btag,btag2);
|
|
667 }
|
|
668 else {
|
|
669 nz=split(which,zz,".");
|
|
670 if ( zz[2] == "txt" || zz[1] == "tags" ) {
|
|
671 printf("<A HREF=\"%s.html#%s\">%s</A>",zz[1],btag,btag2);
|
|
672 }
|
|
673 else {
|
|
674 printf("<A HREF=\"intro.html#%s\">%s</A>",btag,btag2);
|
|
675 }
|
|
676 }
|
|
677 }
|
|
678
|
|
679 function put_this() {
|
|
680 ntab=split(this,ta," ");
|
|
681 for ( nta=1 ; nta <= ntab ; nta++ ) {
|
|
682 ata=ta[nta];
|
|
683 lata=length(ata);
|
|
684 aword="";
|
|
685 for ( iata=1 ; iata <=lata ; iata++ ) {
|
|
686 achar=substr(ata,iata,1);
|
|
687 if ( achar != " " ) { aword=aword""achar; }
|
|
688 else {
|
|
689 if ( aword != "" ) { atag=aword;
|
|
690 see_tag();
|
|
691 aword="";
|
|
692 printf(" "); }
|
|
693 else {
|
|
694 printf(" ");
|
|
695 }
|
|
696 }
|
|
697 }
|
|
698 if ( aword != "" ) { atag=aword;
|
|
699 see_tag();
|
|
700 }
|
|
701 if ( nta != ntab ) { printf(" "); }
|
|
702 }
|
|
703 }
|
|
704
|
|
705 function if_already() {
|
|
706 already="no";
|
|
707 if ( npipe < 2 ) { return; }
|
|
708 if ( atag == ":au" && p[2] == ":autocmd" ) { already="yes";return; }
|
|
709 for ( npp=2 ; npp <= npipe ; npp=npp+2 ) {
|
|
710 if ( ( (index(p[npp],atag)) != 0 \
|
|
711 && length(p[npp]) > length(atag) \
|
|
712 && length(atag) >= 1 \
|
|
713 ) \
|
|
714 || (p[npp] == atag) \
|
|
715 ) {
|
|
716 # printf("p=|%s|,tag=|%s| ",p[npp],atag);
|
|
717 already="yes"; return; }
|
|
718 }
|
|
719 }
|
|
720
|
|
721 function see_opt() {
|
|
722 done_opt="no";
|
|
723 stag=atag;
|
|
724 nfields = split(atag,tae,"=");
|
|
725 if ( nfields > 1 ) {
|
|
726 btag="'"tae[1]"'";
|
|
727 btag2=tae[1];
|
|
728 find_tag3();
|
|
729 if (done == "yes") {
|
|
730 for ( ntae=2 ; ntae <= nfields ; ntae++ ) {
|
|
731 printf("=%s",tae[ntae]);
|
|
732 }
|
|
733 atag=stag;
|
|
734 done_opt="yes";
|
|
735 return;
|
|
736 }
|
|
737 btag=tae[1];
|
|
738 btag2=tae[1];
|
|
739 find_tag3();
|
|
740 if ( done=="yes" ) {
|
|
741 for ( ntae=2 ; ntae <= nfields ; ntae++ ) {
|
|
742 printf("=%s",tae[ntae]);
|
|
743 }
|
|
744 atag=stag;
|
|
745 done_opt="yes";
|
|
746 return;
|
|
747 }
|
|
748 }
|
|
749 nfields = split(atag,tae,""");
|
|
750 if ( nfields > 1 ) {
|
|
751 btag="'"tae[1]"'";
|
|
752 btag2=tae[1];
|
|
753 find_tag3();
|
|
754 if (done == "yes") {
|
|
755 printf(""");
|
|
756 atag=stag;
|
|
757 done_opt="yes";
|
|
758 return;
|
|
759 }
|
|
760 btag=tae[1];
|
|
761 btag2=tae[1];
|
|
762 find_tag3();
|
|
763 if (done == "yes") {
|
|
764 printf(""");
|
|
765 atag=stag;
|
|
766 done_opt="yes";
|
|
767 return;
|
|
768 }
|
|
769 }
|
|
770 btag="'"tae[1]"'";
|
|
771 btag2=tae[1];
|
|
772 find_tag3();
|
|
773 if (done == "yes") {
|
|
774 atag=stag;
|
|
775 done_opt="yes";
|
|
776 return;
|
|
777 }
|
|
778 btag=tae[1];
|
|
779 btag2=tae[1];
|
|
780 find_tag3();
|
|
781 if (done == "yes") {
|
|
782 atag=stag;
|
|
783 done_opt="yes";
|
|
784 return;
|
|
785 }
|
|
786 atag=stag;
|
|
787 }
|