vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

maketags.awk (1047B)


      1 BEGIN   { FS="	"; }
      2 
      3 NR == 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(/&/,"\\&amp;");
     18 	gsub(/>/,"\\&gt;");
     19 	gsub(/</,"\\&lt;");
     20 	gsub(/"/,"\\&quot;");
     21 	gsub(/%/,"\\&#37;");
     22 
     23 	nf=split($0,tag,"	");
     24 	if (counttag[tag[1]] > 0)
     25 	{
     26 		print "==============" > "errors.log"
     27 		print "Duplicate Tag " tag[1] > "errors.log"
     28 		print "==============" > "errors.log"
     29 	}
     30 	counttag[tag[1]]++
     31 	tagkey[t]=tag[1];tagref[t]=tag[2];tagnum[t]=NR;
     32 	print $1 "	" $2 "	line " NR >"tags.ref"
     33 	n=split($2,w,".");
     34 	printf ("|<A HREF=\"%s.html#%s\">%s</A>|	%s\n",w[1],$1,$1,$2);
     35 }
     36 
     37 END     {
     38 	topback();
     39 	print "</PRE>\n</BODY>\n\n\n</HTML>";
     40 	}
     41 
     42 #
     43 # as main we keep index.txt (by default)
     44 # other candidate, help.txt
     45 #
     46 function topback () {
     47 	printf("<A HREF=\"#top\">top</A> - ");
     48 	printf("<A HREF=\"help.html\">back to help</A>\n");
     49 }