home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim54rt.sit / runtime / doc / makehtml.awk < prev    next >
Encoding:
AWK Script  |  1999-08-14  |  16.0 KB  |  739 lines  |  [TEXT/ALFA]

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