PageRenderTime 64ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/runtime/doc/makehtml.awk

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