2 # some initialization variables
7 while ( getline ti
<"tags.ref" > 0 ) {
9 tagkey
[tag
[1]]=
"yes";tagref
[tag
[1]]=tag
[2];
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";
36 # protect special chars
38 /[><&á
]/ {gsub(/&/,"\\&");gsub(/>/,"\\>");gsub(/</,"\\<");gsub("á","\\á");}
40 # end of sample lines by non-blank in first column
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" }
45 # sample lines printed bold unless empty...
47 sample ==
"yes" && $
0 ==
"" { print ""; next; }
48 sample ==
"yes" && $
0 !="" { print "<B>" $
0 "</B>"; next; }
50 # start of sample lines in next line
52 $
0 ==
">" { sample =
"yes"; print ""; next; }
53 substr($
0,length($
0)-4,5) ==
" >" { sample =
"yes"; gsub(/ >
;$
/, ""); }
55 # header lines printed bold, colored
57 substr($
0,length($
0),1) ==
"~" { print "<B><FONT COLOR=\"PURPLE\">" substr($
0,1,length($
0)-1) "</FONT></B>"; next; }
61 /^
"\|\& / {gsub(/\|/,"\\|"); }
62 / = b
/ {gsub(/ b
/," \\b "); }
66 /[ ]\
*.\
*[ ]/ {gsub(/\
*/,"ZWWZ"); }
70 /[ ]\
*[ ]/ {gsub(/ \
* /," \\* ");
71 gsub(/ \
* /," \\* ");
72 gsub(/ \
* /," \\* ");
73 gsub(/ \
* /," \\* "); }
77 /[ ]\
*[^
]/ {gsub(/ \
*/," ZWWZ");gsub(/ \
*/," ZWWZ");}
78 /^\
*[^
]/ {gsub(/^\
*/,"ZWWZ");}
82 /[^
]\
*$
/ {gsub(/\
*$
/,"ZWWZ");}
83 /[^ \
/ ]\
*[ ]/ {gsub(/\
*/,"ZWWZ");}
87 /[ ]\
|[ ]/ {gsub(/ \
| /," \\| ");
88 gsub(/ \
| /," \\| ");
89 gsub(/ \
| /," \\| ");
90 gsub(/ \
| /," \\| "); }
91 /'\|'/ { gsub(/'\|'/,"'\\|'"); }
92 /\^V\
|/ {gsub(/\^V\
|/,"^V\\|");}
93 / \\\
| / {gsub(/\
|/,"\\|");}
95 # one letter pipes and "||" false pipe (digraphs)
97 /[ ]\
|.\
|[ ]/ && asciiart ==
"no" {gsub(/\
|/,"YXXY"); }
98 /^\
|.\
|[ ]/ {gsub(/\
|/,"YXXY"); }
99 /\
|\
|/ {gsub(/\
|\
|/,"\\|\\|"); }
100 /^shellpipe
/ {gsub(/\
|/,"\\|"); }
104 /[ ]\
|[^
]/ && asciiart ==
"no" {gsub(/ \
|/," YXXY");
105 gsub(/ \
|/," YXXY");}
106 /^\
|[^
]/ {gsub(/^\
|/,"YXXY");}
110 /[^
]\
|$
/ && asciiart ==
"no" {gsub(/\
|$
/,"YXXY");}
111 /[^
]\
|[s
,.
); ]/ && asciiart ==
"no" {gsub(/\
|/,"YXXY");}
112 /[^
]\
|]/ && asciiart ==
"no" {gsub(/\
|/,"YXXY");}
116 /'"/ {gsub(/'"/,"\\'\\"'");}
117 /"/ {gsub(/"/,"\\"");}
118 /%
/ {gsub(/%
/,"\\%");}
120 NR ==
1 { nf=
split(FILENAME,f
,".")
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\">";
128 # common case - Latin1
129 print "<META HTTP-EQUIV=\"Content-type\" content=\"text/html; charset=ISO-8859-1\">";
131 print "<TITLE>Vim documentation: " f
[1] "</TITLE>";
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=\"index.html\">main help file</A>\n";
142 filename=f
[1]".html";
145 # set to a low value to test for few lines of text
146 # NR == 99999 { exit; }
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; }
156 nstar =
split($
0,s
,"ZWWZ");
157 for ( i=
2 ; i
<= nstar
; i=i
+2 ) {
158 nbla=
split(s
[i
],blata
,"[ ]");
161 nstar =
split($
0,s
,"ZWWZ");
164 npipe =
split($
0,p
,"YXXY");
165 for ( i=
2 ; i
<= npipe
; i=i
+2 ) {
166 nbla=
split(p
[i
],blata
,"[ ]");
169 ntabs =
split($
0,p
,"YXXY");
175 FILENAME ==
"gui.txt" && asciiart ==
"no" \
176 && $
0 ~
/\
+----/ && $
0 ~
/----\
+/ {
181 FILENAME ==
"quotes.txt" && asciiart ==
"no" \
182 && $
0 ~
/In summary
:/ {
187 FILENAME ==
"usr_20.txt" && asciiart ==
"no" \
188 && $
0 ~
/an empty line at the
end:/ {
193 asciiart ==
"yes" && $
0==
"" { asciicnt
++; }
195 asciiart ==
"yes" && asciicnt ==
2 { asciiart =
"no"; }
197 asciiart ==
"yes" { npipe =
1; }
198 # { print NR " <=> " asciiart; }
203 nstar
> 2 && npipe
< 3 {
205 for ( i=
1; i
<= nstar
; i=i
+2 ) {
209 nbla =
split(s
[ii
],blata
," ");
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
]);
215 printf("*%s*",s
[ii
]);
225 npipe
> 2 && nstar
< 3 {
226 if ( npipe%
2 ==
0 ) {
227 for ( i=
1; i
< npipe
; i
++ ) {
228 gsub("ZWWZ","*",p
[i
]);
231 printf("%s\n",p
[npipe
]);
234 for ( i=
1; i
<= npipe
; i
++ )
237 gsub("ZWWZ","*",p
[i
]);
242 nfn=
split(p
[i
],f
,".");
243 if ( nfn ==
1 || f
[2] ==
"" || f
[1] ==
"" || length(f
[2]) < 3 ) {
247 if ( f
[1] ==
"index" ) {
248 printf "|<A HREF=\"vimindex.html\">" p
[i
] "</A>|";
250 if ( f
[1] ==
"help" ) {
251 printf "|<A HREF=\"index.html\">" p
[i
] "</A>|";
253 printf "|<A HREF=\"" f
[1] ".html\">" p
[i
] "</A>|";
263 # line contains both "|" and "*"
265 npipe
> 2 && nstar
> 2 {
267 for ( j=
1; j
<= nstar
; j=j
+2 ) {
268 npipe =
split(s
[j
],p
,"YXXY");
270 for ( np=
1; np
<=npipe
; np=np
+2 ) {
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
]);
286 printf("*%s*",s
[jj
]);
294 # line contains e-mail address john.doe@some.place.edu
296 $
0 ~
/@
/ && $
0 ~
/[a
-zA
-Z0
-9]@
[a
-z
]/ \
298 nemail=
split($
0,em
," ");
299 if ( substr($
0,1,1) ==
" " ) { printf(" "); }
300 for ( i=
1; i
<= nemail
; 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
);
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));
310 printf("<A HREF=\"mailto:%s\">%s</A> ",em
[i
],em
[i
]);
317 #print "*** " NR " " FILENAME " - possible mail ref";
322 # line contains http / ftp reference
324 $
0 ~
/http
:\
/\
// || $
0 ~
/ftp
:\
/\
// {
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
]);
337 em
[i
]=
substr(em
[i
],1,length(em
[i
])-1);
338 printf(" <A HREF=\"%s\">%s</A>.",em
[i
],em
[i
]);
344 #print "*** " NR " " FILENAME " - possible http ref";
349 # some lines contains just one "almost regular" "*"...
363 { ntabs =
split($
0,tb
," ");
364 for ( i=
1; i
< ntabs
; i
++) {
375 asciiart ==
"yes" && $
0 ~
/\
+-\
+--/ \
376 && $
0 ~
"scrollbar" { asciiart =
"no"; }
380 print "</PRE>\n</BODY>\n\n\n</HTML>"; }
383 # as main we keep index.txt (by default)
385 function topback
() {
386 if ( FILENAME != "tags" ) {
387 if ( FILENAME != "help.txt" ) {
388 printf("<A HREF=\"#top\">top</A> - ");
389 printf("<A HREF=\"index.html\">main help file</A>\n");
391 printf("<A HREF=\"#top\">top</A>\n");
396 function find_tag1
() {
397 if ( p
[i
] ==
"" ) { return; }
398 if ( tagkey
[p
[i
]] ==
"yes" ) {
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";
413 if ( atag ==
"\"--" || atag ==
"--\"" ) { return; }
415 if ( already ==
"yes" ) {
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);
432 if ( already ==
"yes" ) {
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);
444 if ( already ==
"yes" ) {
448 printf("%s",leftchar
);
449 aword=
substr(atag
,1,length(atag
))""lastbut1
""rightchar
;
451 if ( done ==
"yes" ) { printf("%s%s",lastbut1
,rightchar
);return; }
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]); }
461 if ( already ==
"yes" ) {
465 printf("%s",leftchar
);
467 if ( done ==
"yes" ) { printf("%s",rightchar
);return; }
468 printf("%s%s",atag
,rightchar
);
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);
477 if ( already ==
"yes" ) {
483 if ( done ==
"yes" ) { printf("%s",last2
);return; }
484 printf("%s%s",atag
,last2
);
487 if ( last2 ==
".)" ) {
488 atag=
substr(atag
,1,length(atag
)-2);
490 if ( already ==
"yes" ) {
495 if ( done ==
"yes" ) { printf("%s",last2
);return; }
496 printf("%s%s",atag
,last2
);
499 if ( last2 ==
")." ) {
500 atag=
substr(atag
,1,length(atag
)-2);
503 if ( already ==
"yes" ) {
507 if ( done ==
"yes" ) { printf("%s",last2
);return; }
508 printf("%s%s",atag
,last2
);
511 first6=
substr(atag
,1,6);
512 last6=
substr(atag
,length(atag
)-5,6);
513 if ( last6 == atag
) {
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);
522 if ( already ==
"yes" ) {
528 if ( done ==
"yes" ) { printf(""%s",rightchar
); return; }
529 printf("%s"%s",atag
,rightchar
);
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; }
542 if ( already ==
"yes" ) {
543 printf(""%s",atag
);
548 if ( done ==
"yes" ) { return; }
552 if ( last6 ==
""" && first6 ==
""" ) {
553 allow_one_char=
"yes";
554 atag=
substr(atag
,7,length(atag
)-12);
556 if ( already ==
"yes" ) {
562 if ( done ==
"yes" ) { printf("%s",last6
);return; }
563 printf("%s%s",atag
,last6
);
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);
572 if ( already ==
"yes" ) {
578 if ( done ==
"yes" ) { printf("%s%s",last6of7
,rightchar
);return; }
579 printf("%s%s%s",atag
,last6of7
,rightchar
);
585 function find_tag2
() {
587 # no blanks present in a tag...
588 ntags=
split(atag
,blata
,"[ ]");
589 if ( ntags
> 1 ) { return; }
590 if ( ( allow_one_char ==
"no" ) && \
591 ( index("!#$%&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",atag
) !=0 ) ) {
594 if ( skip_word
[atag
] ==
"yes" ) { return; }
595 if ( wasset ==
"yes" && lineset ==
NR ) {
598 if ( done_opt ==
"yes" ) {return;}
600 if ( wasset ==
"yes" && lineset
!= NR ) {
603 if ( atag ==
":set" ) {
607 if ( tagkey
[atag
] ==
"yes" ) {
614 function find_tag3
() {
616 # no blanks present in a tag...
617 ntags=
split(btag
,blata
,"[ ]");
618 if ( ntags
> 1 ) { return; }
619 if ( ( allow_one_char ==
"no" ) && \
620 ( index("!#$%&'()+,-./0:;=?@ACINX\\[\\]^_`at\\{\\}~",btag
) !=0 ) ) {
623 if ( skip_word
[btag
] ==
"yes" ) { return; }
624 if ( tagkey
[btag
] ==
"yes" ) {
631 function put_href
() {
632 if ( p
[i
] ==
"" ) { return; }
633 if ( which ==
FILENAME ) {
634 printf("|<A HREF=\"#%s\">%s</A>|",p
[i
],p
[i
]);
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
]);
642 printf("|<A HREF=\"intro.html#%s\">%s</A>|",p
[i
],p
[i
]);
647 function put_href2
() {
648 if ( atag ==
"" ) { return; }
649 if ( which ==
FILENAME ) {
650 printf("<A HREF=\"#%s\">%s</A>",atag
,atag
);
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
);
658 printf("<A HREF=\"intro.html#%s\">%s</A>",atag
,atag
);
663 function put_href3
() {
664 if ( btag ==
"" ) { return; }
665 if ( which ==
FILENAME ) {
666 printf("<A HREF=\"#%s\">%s</A>",btag
,btag2
);
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
);
674 printf("<A HREF=\"intro.html#%s\">%s</A>",btag
,btag2
);
679 function put_this
() {
680 ntab=
split(this
,ta
," ");
681 for ( nta=
1 ; nta
<= ntab
; nta
++ ) {
685 for ( iata=
1 ; iata
<=lata
; iata
++ ) {
686 achar=
substr(ata
,iata
,1);
687 if ( achar
!= " " ) { aword=aword
""achar
; }
689 if ( aword
!= "" ) { atag=aword
;
698 if ( aword
!= "" ) { atag=aword
;
701 if ( nta
!= ntab
) { printf(" "); }
705 function if_already
() {
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 \
714 || (p
[npp
] == atag
) \
716 # printf("p=|%s|,tag=|%s| ",p[npp],atag);
717 already=
"yes"; return; }
724 nfields =
split(atag
,tae
,"=");
730 for ( ntae=
2 ; ntae
<= nfields
; ntae
++ ) {
731 printf("=%s",tae
[ntae
]);
741 for ( ntae=
2 ; ntae
<= nfields
; ntae
++ ) {
742 printf("=%s",tae
[ntae
]);
749 nfields =
split(atag
,tae
,""");