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