1BEGIN { FS=" "; } 2 3NR == 1 { nf=split(FILENAME,f,".") 4 print "<HTML>"; 5 print "<HEAD><TITLE>" f[1] "</TITLE></HEAD>"; 6 print "<BODY BGCOLOR=\"#ffffff\">"; 7 print "<H1>Vim Documentation: " f[1] "</H1>"; 8 print "<A NAME=\"top\"></A>"; 9 print "<HR>"; 10 print "<PRE>"; 11} 12 13{ 14 # 15 # protect special chars 16 # 17 gsub(/&/,"\\&"); 18 gsub(/>/,"\\>"); 19 gsub(/</,"\\<"); 20 gsub(/"/,"\\""); 21 gsub(/%/,"\\%"); 22 23 nf=split($0,tag," "); 24 tagkey[t]=tag[1];tagref[t]=tag[2];tagnum[t]=NR; 25 print $1 " " $2 " line " NR >"tags.ref" 26 n=split($2,w,"."); 27 printf ("|<A HREF=\"%s.html#%s\">%s</A>| %s\n",w[1],$1,$1,$2); 28} 29 30END { 31 topback(); 32 print "</PRE>\n</BODY>\n\n\n</HTML>"; 33 } 34 35# 36# as main we keep index.txt (by default) 37# other candidate, help.txt 38# 39function topback () { 40 printf("<A HREF=\"#top\">top</A> - "); 41 printf("<A HREF=\"help.html\">back to help</A>\n"); 42} 43