1/* 2 * This script converts the output from manext to HTML 3 * 4 * Arguments: 5 * section: one of OVERVIEW,COMMANDS,APPENDIX,GLOSSARY 6 * infile: file name of .man file 7 * tocfile: file name of Table of Contents output file 8 */ 9Trace o 10Parse Arg html_ext ver section infile tocfile . 11If Left( infile, 2 ) = './' Then infile = Substr( infile, 3 ) 12Select 13 When section = 'TOCSTART' Then Call toc 'START' ver 14 When section = 'TOCEND' Then Call toc 'END' ver 15 When section = 'OVERVIEW' Then Call overview infile tocfile 'Overview' 16 When section = 'COMM' Then Call commands infile tocfile 'Commands' 17 When section = 'COMMSET' Then Call commands infile tocfile 'SET Commands' 18 When section = 'COMMSOS' Then Call commands infile tocfile 'SOS Commands' 19 When section = 'QUERY' Then Call query infile tocfile 'Query and Extract' 20 When section = 'GLOSSARY' Then Call glossary infile tocfile 'Glossary' 21 When section = 'APPENDIX1' Then Call appendix1 infile tocfile 'Appendix 1' 22 When section = 'APPENDIX2' Then Call appendix2 infile tocfile 'Appendix 2' 23 When section = 'APPENDIX3' Then Call appendix2 infile tocfile 'Appendix 3' 24 When section = 'APPENDIX4' Then Call appendix2 infile tocfile 'Appendix 4' 25 When section = 'APPENDIX5' Then Call appendixx infile tocfile 'Appendix 5' 26 When section = 'APPENDIX6' Then Call appendixx infile tocfile 'Appendix 6' 27 When section = 'APPENDIX7' Then Call appendix2 infile tocfile 'Appendix 7' 28 When section = 'HISTORY' Then Call history infile tocfile 'History of THE' 29 When section = 'QUICKREF' Then Call quickref infile tocfile 'Quick Reference for THE' 30 When section = 'FDL' Then Call fdl infile tocfile 'GNU Free Documentation License' 31 Otherwise 32 Do 33 Say 'Error: Invalid section:' section 'specified' 34 End 35End 36Return 37 38/********************************************************************/ 39overview: Procedure Expose html_ext 40Parse arg infile tocfile title 41toc. = '' 42toc_idx = 0 43in_code_section = 'N' 44already_read = 'N' 45in_list_section = 'N' 46in_sublist_section = 'N' 47first_heading = 'N' 48Call heading title 49Do While(Lines(infile)>0) 50 If already_read = 'N' Then line = Linein(infile) 51 already_read = 'N' 52 Select 53 When Strip(line) = Copies('=',72) Then 54 Do 55 line = Strip(Linein(infile)) 56 toc_idx = toc_idx + 1 57 toc.toc_idx = '<DT>'MakeTOC(line,"")'</DT>' 58 Say '<HR>' 59 Say '<A NAME="' || RemoveSpaces(line) || '"></A>' 60 Say '<H2>' line '</H2>' 61 line = Linein(infile) 62 Say '<HR>' 63 first_heading = 'Y' 64 End 65 When Strip(line) = Copies('-',74) Then Iterate 66 When Substr(Strip(line),1,2) = '- 'Then 67 Do 68 tmp = '' 69 If in_list_section = 'Y' Then 70 Do 71 tmp = Substr(Strip(line),3) 72 Do Forever 73 line = Linein(infile) 74 Select 75 When Strip(line) = '' Then 76 Do 77 Say '<LI>' handle_keywords(tmp,'') '</LI>' 78 Say '</UL>' 79 in_list_section = 'N' 80 End 81 When Substr(Strip(line),1,2) = '- ' Then 82 Do 83 Say '<LI>' handle_keywords(tmp,'') '</LI>' 84 already_read = 'Y' 85 End 86 When Substr(Strip(line),1,2) = 'o ' Then 87 Do 88 If in_sublist_section = 'N' Then tmp = tmp '<(DL)>' 89 in_sublist_section = 'Y' 90 tmp = tmp '<(DD)>'Subword(line,2) 91 End 92 Otherwise 93 Do 94 If in_sublist_section = 'Y' Then 95 Do 96 tmp = tmp '<(/DL)><(BR)>'line 97 in_sublist_section = 'N' 98 End 99 Else tmp = tmp line 100 End 101 End 102 If in_list_section = 'N' | already_read = 'Y' Then Leave 103 End 104 End 105 Else 106 Do 107 Say '<UL>' 108 in_list_section = 'Y' 109 already_read = 'Y' 110 End 111 End 112 When Strip(line) = '+'||Copies('-',30) Then 113 Do 114 If in_code_section = 'Y' Then 115 Do 116 Say '</blockquote></td></tr></table><br>' 117 in_code_section = 'N' 118 End 119 Else 120 Do 121 Say '<table width="100%" border="1" cellpadding="4" cellspacing="0" bgcolor="#cccccc"><tr><td><blockquote>' 122 in_code_section = 'Y' 123 End 124 End 125 Otherwise 126 Do 127 If first_heading = 'N' Then Iterate 128 If in_code_section = 'Y' Then 129 Do 130 Say Strip(line) '<BR>' 131 End 132 Else 133 Do 134 tmp = '' 135 If Strip(line) = '' Then Iterate 136 Do Forever 137 tmp = tmp line 138 line = Linein(infile) 139 If Strip(line) = '' Then 140 Do 141 tmp = handle_keywords(tmp,"") 142 Say tmp '<P>' 143 Leave 144 End 145 End 146 End 147 End 148 End 149End 150Do i = 1 To toc_idx 151 Call Lineout tocfile, toc.i 152End 153Say '<P Align="Center"><HR>' 154Say 'The HTML version of this manual was inspired by <A HREF = "mailto:judygs@uic.edu">Judith Grobe Sachs </A>' 155Say '<P Align="Center"><HR>' 156Call footing 157Return 158 159/********************************************************************/ 160commands: Procedure Expose html_ext 161Parse arg infile tocfile title 162toc. = '' 163toc_idx = 0 164already_read_line = 'N' 165once = 'Y' 166Call heading title 167Do While(Lines(infile)>0) 168 If already_read_line = 'N' Then line = Linein(infile) 169 already_read_line = 'N' 170 Select 171 When Strip(line) = Copies('=',72) Then 172 Do 173 line = Strip(Linein(infile)) 174 toc_idx = toc_idx + 1 175 toc.toc_idx = '<DT>'MakeTOC(line,"")'</DT>' 176 Say '<P><HR><A NAME="' || RemoveSpaces(line) || '"></A>' 177 Say '<H2>' line '</H2>' 178 line = Linein(infile) 179 End 180 When Strip(line) = Copies('-',74) Then 181 Say '<HR>' 182 When line = ' COMMAND' Then 183 Do 184 line = Linein(infile) 185 Parse var line keyword '-' desc 186 keyword = Strip(keyword) 187 keyword_words = Words(keyword) 188 Say '<A NAME="'||RemoveSpaces(SpecialTranslate(keyword))||'"></A>' 189 Say '<DL><DT>' 190/* 191 Say Bold(Translate(keyword)) '-' desc '<BR><BR></DT>' 192*/ 193 Say '<h3>'Translate(keyword) '-' desc '</h3></DT>' 194 toc_idx = toc_idx + 1 195 toc.toc_idx = '<DD>'MakeTOC(keyword,desc)'</DD>' 196 End 197 When line = ' SEE ALSO' Then 198 Do 199 Say '<DT>' Bold('See Also:') '<BR></DT>' 200 line = Linein(infile) 201 tmp = '' 202 Do Forever 203 Parse Var line '<' keyword '>' line 204 If keyword = '' Then Leave 205 tmp = tmp MakeRef('UPPER',',',keyword) 206 If line = '' Then Leave 207 End 208 tmp = Strip(tmp,'T',',') 209 Say '<DD>' tmp '<P></DD>' 210 End 211 When line = ' STATUS' Then 212 Do 213 Say '<DT>' Bold('Status:') '<BR></DT>' 214 Do Forever 215 line = Linein(infile) 216 If line = '' Then Leave 217 Say '<DD>' Strip(line) '</DD>' 218 End 219 Say '</DL><P>' 220 End 221 When line = ' SYNTAX' Then 222 Do 223 Say '<DT>' Bold('Syntax:') '<BR></DT>' 224 syntax_words = '' 225 Do Forever 226 line = Linein(infile) 227 If line = '' Then Leave 228 pre = Subword(line,1,keyword_words) 229 post = Subword(line,keyword_words+1) 230 Say '<DD>' Strip(pre) Italic(strip(post)) '<P></DD>' 231 syntax_words = syntax_words Translate(post," ","/|[].") 232 End 233 End 234 When line = ' COMPATIBILITY' Then 235 Do 236 Say '<DT>' Bold('Compatibility:') '<BR></DT>' 237 first = 'Y' 238 Do Forever 239 line = Linein(infile) 240 If line = '' Then Leave 241 If first = 'Y' Then 242 Do 243 Say '<DD>' handle_keywords(Strip(line),'') 244 first = 'N' 245 End 246 Else 247 Say '</DD><DD>' handle_keywords(Strip(line),'') 248 End 249 Say '<P></DD>' 250 End 251 When line = ' DEFAULT' Then 252 Do 253 Say '<DT>' Bold('Default:') '<BR></DT>' 254 Do Forever 255 line = Linein(infile) 256 If line = '' Then Leave 257 Parse Var line pre '<' keyword '>' post 258 If keyword \= '' Then line = pre MakeRef('UPPER',,keyword) post 259 Say '<DD>' Strip(line) '<P></DD>' 260 End 261 End 262 When line = ' DESCRIPTION' Then 263 Do 264 Say '<DT>' Bold('Description:') '<BR></DT>' 265 tmp = '' 266 inblock = 0 267 Do Forever 268 line = Linein(infile) 269 If Substr(Strip(line),1,31) = '+'||Copies('-',30) Then 270 Do 271 Say '<table width="100%" border="1" cellpadding="4" cellspacing="0" bgcolor="#cccccc"><tr><td><blockquote>' 272 Do Forever 273 line = Linein(infile) 274 If Substr(Strip(line),1,31) = '+'||Copies('-',30) Then Leave 275 Say line '<BR>' 276 End 277 Say '</blockquote></td></tr></table><br>' 278 Iterate 279 End 280 If Substr(Strip(line),1,31) = '*'||Copies('-',30) Then 281 Do 282 Say '<PRE>' 283 Do Forever 284 line = Linein(infile) 285 If Substr(Strip(line),1,31) = '*'||Copies('-',30) Then Leave 286 Say line 287 End 288 Say '</PRE><P>' 289 Iterate 290 End 291 If Strip(line) = '' Then 292 Do 293 tmp = handle_keywords(tmp,syntax_words) 294 Say '<DD>' Strip(tmp) '<P></DD>' 295 If Substr(tmp,Length(tmp),1) = ':' Then 296 Do 297 first = 'Y' 298 Do Forever 299 line = Strip(Linein(infile)) 300 If line = '' Then Leave 301 If first = 'Y' Then 302 Do 303 Say '<DD>' handle_keywords(line,syntax_keywords) 304 first = 'N' 305 End 306 Else 307 Say '</DD><DD>' handle_keywords(line,syntax_keywords) 308 End 309 Say '<P></DD>' 310 End 311 tmp = '' 312 Iterate 313 End 314 If line = ' COMPATIBILITY' Then 315 Do 316 already_read_line = 'Y' 317 Leave 318 End 319 If Pos('<>',line) \= 0 Then 320 Do 321 Parse Var line pre '<>' post 322 line = pre||'<>'||post 323 End 324 tmp = tmp line 325 End 326 End 327 Otherwise Nop 328 End 329End 330Do i = 1 To toc_idx 331 Call Lineout tocfile, toc.i 332End 333Call footing 334Return 335 336/********************************************************************/ 337glossary: Procedure Expose html_ext 338Parse arg infile tocfile title 339toc. = '' 340toc_idx = 0 341already_read_line = 'N' 342first_time = 'Y' 343Call heading title 344Do While(Lines(infile)>0) 345 If already_read_line = 'N' Then line = Linein(infile) 346 already_read_line = 'N' 347 Select 348 When Strip(line) = Copies('=',72) Then 349 Do 350 line = Strip(Linein(infile)) 351 toc_idx = toc_idx + 1 352 toc.toc_idx = '<DT>'MakeTOC(line,"")'</DT>' 353 Say '<HR><A NAME="' || RemoveSpaces(line) || '"></A>' 354 Say '<H2>' line '</H2>' 355 Say '<HR><P>' 356 Say '<DL>' 357 line = Linein(infile) 358 End 359 When Strip(line) = '' Then Nop 360 When Strip(line) = Copies('-',74) Then Say '</DL><HR>' 361 When Substr(line,1,15) = Copies(' ',15) Then 362 Do 363 tmp = Strip(line) 364 Do Forever 365 line = Strip(Linein(infile)) 366 If line = '' Then Leave 367 tmp = tmp line 368 End 369 tmp = handle_keywords(tmp,'') 370 tmp = ConvertSpecialChars(tmp) 371 Say '<DD>' Strip(tmp) '<P></DD>' 372 End 373 Otherwise 374 Do 375 line = Strip(line) 376 Say '<DT><A NAME="' || RemoveSpaces(Translate(line)) || '">' Bold(line) '</A></DT>' 377 toc_idx = toc_idx + 1 378 toc.toc_idx = '<DD>'MakeTOC(line,"")'</DD>' 379 End 380 End 381End 382Do i = 1 To toc_idx 383 Call Lineout tocfile, toc.i 384End 385Call footing 386Return 387 388/********************************************************************/ 389query: Procedure Expose html_ext 390Parse arg infile tocfile title 391toc. = '' 392toc_idx = 0 393already_read_line = 'N' 394once = 'Y' 395in_table = 'N' 396first_time = 'Y' 397Call heading title 398Do While(Lines(infile)>0) 399 If already_read_line = 'N' Then line = Linein(infile) 400 already_read_line = 'N' 401 Select 402 When Strip(line) = Copies('=',72) Then 403 Do 404 line = Strip(Linein(infile)) 405 toc_idx = toc_idx + 1 406 toc.toc_idx = '<DT>'MakeTOC(line,"")'</DT>' 407 If first_time = 'N' Then Say '</DL>' 408 first_time = 'N' 409 Say '<A NAME="' || RemoveSpaces(Translate(line)) || '"></A>' 410 Say '<HR><H2>' line '</H2>' 411 Say '<HR><DL>' 412 line = Linein(infile) 413 End 414 When Strip(line) = '' & in_table = 'Y' Then 415 Do 416 in_table = 'N' 417 Say '</TABLE><P></DD>' 418 End 419 When Strip(line) = '' Then Nop 420 When Strip(line) = Copies('-',74) Then 421 Do 422 Say '</DL>' 423 Say '<HR>' 424 End 425 When Substr(line,26,3) = ' - ' Then 426 Do 427 If in_table = 'N' Then 428 Do 429 Say '<DD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1>' 430 in_table = 'Y' 431 End 432 Parse Var line col1 27 '-' col2 433 Say '<TR><TD>'||Strip(col1)||'</TD><TD>-</TD><TD>'||handle_keywords(Strip(col2),'')||'</TD></TR>' 434 End 435 When Substr(line,1,15) = Copies(' ',15) Then 436 Do 437 Say '<DD>' Strip(line) '</DD>' 438 End 439 When Substr(line,1,14) = Copies(' ',14) Then 440 Do 441 Say '<dd><br><table width="100%" border="1" cellpadding="4" cellspacing="0" bgcolor="#cccccc"><tr><td><blockquote>' 442 Say Strip(line)'<br>' 443 Do Forever 444 line = Linein(infile) 445 If Strip(line) = '' Then Leave 446 Say Strip(line)'<br>' 447 End 448 Say '</blockquote></td></tr></table><br></dd>' 449 End 450 When Substr(line,1,10) = Copies(' ',10) Then 451 Do 452 tmp = line 453 Do Forever 454 line = Strip(Linein(infile)) 455 Select 456 When Substr(line,1,1) = '(' Then 457 Do 458 tmp = handle_keywords(tmp,'') 459 Say '<DD>' Strip(tmp) '</DD>' 460 Say '<DD>' line '<P></DD>' 461 Leave 462 End 463 When line = '' Then 464 Do 465 tmp = handle_keywords(tmp,'') 466 Say '<DD>' Strip(tmp) '<P></DD>' 467 Leave 468 End 469 Otherwise 470 Do 471 tmp = tmp line 472 End 473 End 474 End 475 End 476 Otherwise 477 Do 478 pre = Subword(line,1,1) 479 post = Subword(line,2) 480 Say '<A NAME="' || RemoveSpaces(Translate(Strip(pre))) || '"></A>' 481 Say '<DT>' 482/* 483 If post = '' Then Say Bold(Strip(pre)) '<BR>' 484 Else Say Bold(Strip(pre)) Italic(Strip(post)) '<BR>' 485*/ 486 If post = '' Then Say '<h3>'Strip(pre)'</h3>' 487 Else Say '<h3>'Strip(pre) Strip(post)'</h3>' 488 Say '</DT>' 489 syntax_words = Translate(post," ","/|[].") 490 End 491 End 492End 493Do i = 1 To toc_idx 494 Call Lineout tocfile, toc.i 495End 496Call footing 497Return 498 499/********************************************************************/ 500history: Procedure Expose html_ext 501Parse arg infile tocfile title 502toc. = '' 503toc_idx = 0 504in_env = 'N' 505Call heading title 506inlist = 0 507ul = '' 508toc_idx = toc_idx + 1 509toc.toc_idx = '<DT>'MakeTOC(title,"")'</DT>' 510Say '<A NAME="' || RemoveSpaces(Translate(title)) || '"></A>' 511Say '<H2>' title '</H2>' 512Do While(Lines(infile)>0) 513 line = Linein(infile) 514 Select 515 When Strip(line) = '' Then Nop 516 When Substr(line,1,7) = 'Version' Then 517 Do 518 If inlist Then 519 Do 520 If ul \= '' Then Say ul 521 inlist = 0 522 Say '</UL>' 523 End 524 Parse Var line v ver dt tail 525 head = v ver 526 toc_idx = toc_idx + 1 527 toc.toc_idx = '<DD>'MakeTOC(Strip(head),dt tail)'</DD>' 528 Say '<A NAME="' || RemoveSpaces(Translate(Strip(head))) || '"></A>' 529 Say '<HR>' 530 Say '<H3>' line '</H3>' 531 Say '<HR>' 532 ul = '' 533 End 534 When Substr(line,1,4) = " ---" Then 535 Do 536 If inlist Then 537 Do 538 If ul \= '' Then Say ul 539 inlist = 0 540 Say '</UL>' 541 End 542 Say '<H4>'||Substr(line,5)||'</H4><UL>' 543 ul = '' 544 End 545 When Substr(line,1,6) = " o" Then 546 Do 547 If ul \= '' Then Say ul 548 ul = '<LI>' Strip(Substr(line,7)) 549 inlist = 1 550 End 551 When line = " +---------------" Then 552 Do 553 If ul \= '' Then Say ul 554 Say '<PRE>' 555 inblock = 0 556 Do Forever 557 line = Linein(infile) 558 If line = " +---------------" Then Leave 559 Say line 560 End 561 Say '</PRE><P>' 562 ul = '' 563 End 564 Otherwise 565 Do 566 ul = ul Strip(line) 567 End 568 End 569End 570Do i = 1 To toc_idx 571 Call Lineout tocfile, toc.i 572End 573If ul \= '' Then Say '<LI>' ul 574Say '</UL><HR>' 575Call footing 576Return 577 578/********************************************************************/ 579appendix1: Procedure Expose html_ext 580Parse arg infile tocfile title 581toc. = '' 582toc_idx = 0 583in_env = 'N' 584Call heading title 585Do While(Lines(infile)>0) 586 line = Linein(infile) 587 Select 588 When Strip(line) = Copies('=',72) Then 589 Do 590 line = Strip(Linein(infile)) 591 Parse Var line head '-' tail 592 toc_idx = toc_idx + 1 593 toc.toc_idx = '<DT>'MakeTOC(Strip(head),tail)'</DT>' 594 Say '<A NAME="' || RemoveSpaces(Strip(head)) || '"></A>' 595 Say '<H2>' line '</H2>' 596 Say '<HR>' 597 line = Linein(infile) 598 End 599 When Strip(line) = Copies('-',74) Then Say '<HR>' 600 When Strip(line) = Copies('*',9) Then Say '<B><CENTER>'line'</CENTER></B>' 601 When Substr(Strip(line),1,15) = Copies('-',15) Then 602 Do 603 line = Strip(Linein(infile)) 604 Say '<HR>' 605 Say '<CENTER><h3>'||line||'</h3></CENTER>' 606 line = Linein(infile) 607 Say '<HR>' 608 End 609 When Substr(line,1,10) = ' THE_' Then 610 Do 611 Parse Var line env '-' rem 612 If in_env = 'N' Then Say '<DL>' 613 in_env = 'Y' 614 rem = handle_keywords(rem,'') 615 Say '<DT><B>'env'</B></DT>' 616 Say '<DD>' rem '<P></DD>' 617 End 618 When Strip(line) = '' & in_env = 'Y' Then 619 Do 620 Say '</DL>' 621 in_env = 'N' 622 End 623 When Strip(line) = '' Then Nop 624 Otherwise 625 Do 626 tmp = Strip(line) 627 Do Forever 628 line = Strip(Linein(infile)) 629 If line = '' Then Leave 630 tmp = tmp line 631 End 632 tmp = handle_keywords(tmp,'') 633 Say tmp '<P>' 634 End 635 End 636End 637Do i = 1 To toc_idx 638 Call Lineout tocfile, toc.i 639End 640Call footing 641Return 642 643/********************************************************************/ 644appendix2: Procedure Expose html_ext section 645Parse arg infile tocfile title 646toc. = '' 647toc_idx = 0 648before_table = 1 649Call heading title 650Do While(Lines(infile)>0) 651 line = Linein(infile) 652 Select 653 When Strip(line) = Copies('=',72) Then 654 Do 655 line = Strip(Linein(infile)) 656 Parse Var line head '-' tail 657 toc_idx = toc_idx + 1 658 toc.toc_idx = '<DT>'MakeTOC(Strip(head),tail)'</DT>' 659 Say '<A NAME="' || RemoveSpaces(Strip(head)) || '"></A>' 660 Say '<H2>' line '</H2>' 661 Say '<HR>' 662 line = Linein(infile) 663 End 664 When Strip(line) = Copies('-',74) Then Say '<HR>' 665 When Substr(Strip(line),1,2) = '--' & section = 'APPENDIX4' Then 666 Do 667 line = Linein(infile) 668 Say '<H3>' Strip(line) '</H3><P>' 669 line = Linein(infile) 670 End 671 When Substr(Strip(line),1,2) = '..' & section = 'APPENDIX4' Then 672 Do 673 line = Linein(infile) 674 Say '<H4>' Strip(line) '</H4><P>' 675 line = Linein(infile) 676 End 677 When Substr(Strip(line),1,1) = '-' Then 678 Do 679 line = Linein(infile) 680 Say '<B>' Strip(line) '</B><P>' 681 line = Linein(infile) 682 End 683 When Substr(Strip(line),1,2) = '==' Then 684 Do 685 line = Linein(infile) 686 Say '<H2>' Strip(line) '</H2><P>' 687 line = Linein(infile) 688 End 689 When Substr(Strip(line),1,5) = '+----' & Length(Strip(line)) = 31 Then 690 Do 691 Say '<table width="100%" border="1" cellpadding="4" cellspacing="0" bgcolor="#cccccc"><tr><td><blockquote>' 692 Do Forever 693 line = Strip(Linein(infile)) 694 If Substr(line,1,5) = '+----' Then Leave 695 If Pos('<',line) \= 0 Then 696 Do 697 Parse Var line pre '<Key>' rem 698 Say Strip(pre) '<Key>'||rem '<BR>' 699 End 700 Else 701 Say line '<BR>' 702 End 703 Say '</blockquote></td></tr></table><p>' 704 End 705 When Substr(Strip(line),1,5) = '+----' Then 706 Do 707 before_table = 0 708 columns = Words(Translate(line,' ','-')) - 1 709 If columns = 1 Then 710 Do 711 align1 = '<CENTER>' 712 align2 = '</CENTER>' 713 End 714 Else 715 Do 716 align1 = '' 717 align2 = '' 718 End 719 Say '<CENTER><TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2>' 720 line = Strip(Linein(infile)) 721 line = Strip(Strip(line,,'|')) 722 tmp = '<TR>' 723 Do i = 1 To columns 724 Parse Var line col '|' line 725 If col = '' Then col = '<BR>' 726 tmp = tmp'<TH>'Strip(col)'</TH>' 727 End 728 Say tmp'</TR>' 729 line = Linein(infile) /* remove heading underline */ 730 col. = '' 731 Do Forever 732 line = Strip(Linein(infile)) 733 If line = '' Then Leave 734 If Translate(line,' ','+-') = '' Then 735 Do 736 /* write out the row */ 737 tmp = '<TR>' 738 Do i = 1 To columns 739 tmp = tmp'<TD>'||align1||col.i||align2||'</TD>' 740 End 741 Say tmp'</TR>' 742 col. = '' 743 Iterate 744 End 745 line = Strip(Strip(line,,'|')) 746 If columns = 1 & line = '|' Then col.1 = col.1||'|'||'<BR>' 747 Else 748 Do i = 1 To columns 749 Parse Var line col '|' line 750 col.i = col.i||Strip(col)||'<BR>' 751 End 752 End 753 /* write out the row */ 754 tmp = '<TR>' 755 Do i = 1 To columns 756 tmp = tmp'<TD>'||align1||col.i||align2||'</TD>' 757 End 758 Say tmp'</TR></TABLE></CENTER><P>' 759 End 760 When Strip(line) = '' Then Nop 761 When Substr(line,1,7) = Copies(' ',7) Then 762 Do 763 Say '<DD>'Strip(line)'</DD>' 764 End 765 Otherwise 766 Do 767 tmp = Strip(line) 768 Do Forever 769 line = linein(infile) 770 If Strip(line) = '' Then Leave 771 Select 772 When section = 'APPENDIX4' Then 773 Do 774 Select 775 When Substr(Strip(line),1,7) = 'Syntax:' | Substr(Strip(line),1,19) = 'Meaning of options:' | Substr(Strip(line),1,17) = "ECOLOR Character:" Then 776 Do 777 If tmp \= '' Then 778 Do 779 tmp = handle_keywords(tmp,'') 780 Say tmp '<BR>' 781 End 782 Say '<I><B>'Strip(line)'</B></I><BR>' 783 tmp = '' 784 End 785 When Substr(line,1,8) = Copies(' ',8) & Substr(line,9,1) \= ' ' Then 786 Do 787 If tmp \= '' Then 788 Do 789 tmp = handle_keywords(tmp,'') 790 Say tmp '<BR>' 791 End 792 Say '<I>'Strip(line)'</I><BR>' 793 tmp = '' 794 End 795 Otherwise tmp = tmp Strip(line) 796 End 797 End 798 When section = 'APPENDIX7' & Pos(Right( Strip( line ), 1 ), ':;.' ) \= 0 Then 799 Do 800 If before_table Then Say handle_keywords( tmp Strip( line ) )'<BR>' 801 Else Say tmp Strip( line )'<BR>' 802 tmp = '' 803 End 804 Otherwise tmp = tmp Strip(line) 805 End 806 End 807 tmp = handle_keywords(tmp,'') 808 Say tmp '<P>' 809 End 810 End 811End 812Do i = 1 To toc_idx 813 Call Lineout tocfile, toc.i 814End 815Call footing 816Return 817 818/********************************************************************/ 819appendixx: Procedure Expose html_ext section 820Parse arg infile tocfile title 821If section = 'APPENDIX5' Then head = 'DEFAULT STATUS SETTINGS IN THE' 822Else head = 'THE BY TASKS' 823Do While Lines(infile) > 0 824 line = Linein(infile) 825 pos = Pos('.htm',line) 826 If pos \= 0 & html_ext \= '.htm' Then 827 Do 828 Parse Var line start '.htm' end 829 line = start || html_ext || end 830 End 831 Say line 832End 833If section = 'APPENDIX5' Then infile = 'app5.man' 834Else infile = 'app6.man' 835Call Lineout tocfile, '<DT>'MakeTOC(Translate(title),head)'</DT>' 836Return 837 838/********************************************************************/ 839quickref: Procedure Expose html_ext 840Parse arg infile tocfile title 841toc. = '' 842toc_idx = 0 843table_head. = '' 844colval. = '' 845in_table = 'N' 846in_start = 'Y' 847Call heading title 848toc_idx = toc_idx + 1 849toc.toc_idx = '<DT>'MakeTOC(title,"")'</DT>' 850Say '<A NAME="' || RemoveSPaces(Translate(title)) || '"></A>' 851Call Charout ,'<center><h1>' 852Do While(Lines(infile)>0) 853 line = Linein(infile) 854 If in_start = 'Y' Then 855 Do 856 line = Strip(line) 857 If Length(line) = 0 Then 858 Do 859 in_start = 'N' 860 Say '</h1></center>' 861 Say '<CENTER><HR></CENTER>' 862 Iterate 863 End 864/* 865 Say '<CENTER><H1>' line '</H1></CENTER>' 866*/ 867 Say line'<br>' 868 Iterate 869 End 870 Select 871 When Strip(line) = Copies('-',74) Then Say '<HR>' 872 When Substr(Strip(line),1,1) = '-' Then 873 Do 874 line = Linein(infile) 875 header = Strip(line) 876 toc_idx = toc_idx + 1 877 toc.toc_idx = '<DD>'MakeTOC(header,'')'</DD>' 878 Say '<A NAME="' || RemoveSpaces(Translate(header)) || '"></A>' 879 Say '<H2>' header '</H2>' 880 line = Linein(infile) 881 End 882 When Strip(line) = '+'||Copies('-',30) Then 883 Do 884 If in_code_section = 'Y' Then 885 Do 886 Say '</blockquote></td></tr></table><br>' 887 in_code_section = 'N' 888 End 889 Else 890 Do 891 Say '<table width="100%" border="1" cellpadding="4" cellspacing="0" bgcolor="#cccccc"><tr><td><blockquote>' 892 in_code_section = 'Y' 893 End 894 End 895 When Substr(Strip(line),1,5) = '+----' Then 896 Do 897 columns = Words(Translate(line,' ','-')) - 1 898 If columns = 1 Then 899 Do 900 align1 = '<CENTER>' 901 align2 = '</CENTER>' 902 End 903 Else 904 Do 905 align1 = '' 906 align2 = '' 907 End 908 Say '<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2>' 909 line = Strip(Linein(infile)) 910 tmp = '<TR>' 911 Do i = 0 To columns 912 Parse Var line col '|' line 913 If col = '' Then col = '<BR>' 914 table_head.i = Strip(col)'<BR>' 915 End 916 Do Forever 917 line = Strip(Linein(infile)) 918 If Substr(line,1,5) = '+----' Then Leave 919 Do i = 0 To columns 920 Parse Var line col '|' line 921 If col = '' Then col = '<BR>' 922 table_head.i = table_head.i||Strip(col)||'<BR>' 923 End 924 End 925 tmp = '' 926 Do i = 1 To columns 927 tmp = tmp'<TH>'table_head.i'</TH>' 928 End 929 Say tmp'</TR>' 930 col. = '' 931 Do Forever 932 line = Strip(Linein(infile)) 933 If Substr(line,1,5) = '+----' Then Leave 934 If line = '' | Translate(line,' ','+-') = '' Then Leave 935 line = Strip(Strip(line,,'|')) 936 If columns = 1 & line = '|' Then col.1 = col.1||'|'||'<BR>' 937 Else 938 Do i = 1 To columns 939 Parse Var line col '|' line 940 col.i = col.i||Strip(col)||'<BR>' 941 End 942 End 943 tmp = '<TR>' 944 Do i = 1 To columns 945 tmp = tmp'<TD>'||align1||col.i||align2||'</TD>' 946 End 947 Say tmp'</TR></TABLE><P>' 948 End 949 When Strip(line) = '' Then Nop 950 When header = 'Command-line invocation' Then 951 Do 952 Select 953 When Word(line,1) = 'the' Then 954 Do 955 Say '<B>' Strip(line) '</B><P>' 956 End 957 When Word(line,1) = 'Where:' Then 958 Do 959 Say '<B>' Strip(line) '</B><P>' 960 Say '<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2><TR>' 961 ar = '<TD>' 962 dr = '<TD>' 963 Do Forever 964 line = Linein(infile) 965 If Strip(line) = '' Then Leave 966 Parse Var line 1 arg 19 desc 967 arg = Strip(arg) 968 desc = Strip(desc) 969 ar = ar arg'<BR>' 970 dr = dr desc'<BR>' 971 End 972 Say ar'</TD>' 973 Say dr'</TD>' 974 Say '</TR></TABLE><P>' 975 End 976 When Word(line,1) = 'Option' Then 977 Do 978 Say '<B>' Strip(line) '</B><BR>' 979 End 980 Otherwise Nop 981 End 982 End 983 When header = 'Prefix commands' Then 984 Do 985 Say '<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2><TR>' 986 ar = '<TD>' 987 dr = '<TD>' 988 Do Forever 989 Parse Var line arg '-' desc 990 arg = Strip(arg) 991 desc = Strip(desc) 992 ar = ar arg'<BR>' 993 dr = dr desc'<BR>' 994 line = Linein(infile) 995 If Strip(line) = '' Then Leave 996 End 997 Say ar'</TD>' 998 Say dr'</TD>' 999 Say '</TR></TABLE><P>' 1000 End 1001 When header = 'Line Targets' Then 1002 Do 1003 If in_code_section = 'Y' Then 1004 Do 1005 Say Strip(line) '<BR>' 1006 End 1007 Else 1008 Say line 1009/* 1010 Say '<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2><TR>' 1011 ar = '<TD>' 1012 dr = '<TD>' 1013 Do Forever 1014 Parse Var line arg 27 desc 1015 arg = Strip(arg) 1016 desc = Strip(desc) 1017 ar = ar arg'<BR>' 1018 dr = dr desc'<BR>' 1019 line = Linein(infile) 1020 If Strip(line) = '' Then Leave 1021 End 1022 Say ar'</TD>' 1023 Say dr'</TD>' 1024 Say '</TR></TABLE><P>' 1025 Do Forever 1026 line = Strip(Linein(infile)) 1027 If line = '' Then Leave 1028 Say line '<BR>' 1029 End 1030*/ 1031 End 1032 When Substr(line,2,5) = '[SET]' | Substr(line,2,3) = 'SET' Then 1033 Do 1034 If Translate(Word(line,2)) = 'SET_COMMAND' Then 1035 Say '<A HREF = "comm' || html_ext || '#SET"> SET' Word(line,2) '</A>' Subword(line,3) '<BR>' 1036 Else 1037 Say '<A HREF = "commset' || html_ext || '#SET' || Translate(Word(line,2))'"> [SET]' Word(line,2) '</A>' Subword(line,3) '<BR>' 1038 End 1039 When Substr(line,2,3) = 'SOS' Then 1040 Do 1041 If Translate(Word(line,2)) = 'SOS_COMMAND' Then 1042 Say '<A HREF = "comm' || html_ext || '#SOS"> SOS' Word(line,2) '</A>' Subword(line,3) '<BR>' 1043 Else 1044 Say '<A HREF = "commsos' || html_ext || '#SOS' || Translate(Word(line,2))'"> SOS' Word(line,2) '</A>' Subword(line,3) '<BR>' 1045 End 1046 When Substr(line,2,1) \= ' ' Then 1047 Do 1048 Select 1049 When Word(line,1) = '[Locate]' Then word1 = 'LOCATE' 1050 When Substr(Word(line,1),1,1) = '?' Then word1 = SpecialTranslate('?') 1051 When Substr(Word(line,1),1,1) = '!' Then word1 = SpecialTranslate('!') 1052 When Substr(Word(line,1),1,1) = '=' Then word1 = SpecialTranslate('=') 1053 When Substr(Word(line,1),1,1) = '&' Then word1 = SpecialTranslate('&') 1054 Otherwise word1 = Translate(Word(line,1)) 1055 End 1056 Say '<A HREF = "comm' || html_ext || '#'word1'">' Word(line,1) '</A>' Subword(line,2) '<BR>' 1057 End 1058 When Substr(line,1,7) = Copies(' ',7) Then 1059 Do 1060 Say Strip(line)'<BR>' 1061 End 1062 Otherwise 1063 Do 1064 tmp = Strip(line) 1065 Do Forever 1066 line = Strip(linein(infile)) 1067 If line = '' Then Leave 1068 tmp = tmp line 1069 End 1070 tmp = handle_keywords(tmp,'') 1071 Say tmp '<P>' 1072 End 1073 End 1074End 1075Do i = 1 To toc_idx 1076 Call Lineout tocfile, toc.i 1077End 1078Call footing 1079Return 1080 1081/********************************************************************/ 1082fdl: Procedure Expose html_ext section 1083Parse arg infile tocfile title 1084Call heading thisfile,,title 1085Do While(Lines(infile)>0) 1086 Say Linein(infile) 1087End 1088infile = 'fdl.man' 1089Call Lineout tocfile, '<DT>'MakeTOC(Translate(title),"")'</DT>' 1090Return 1091 1092/********************************************************************/ 1093toc: Procedure Expose html_ext 1094Parse arg action ver 1095If action = 'START' Then 1096 Do 1097 Call heading 'Table of Contents' 1098 Say '<HR><CENTER><H1>The Hessling Editor<br>' 1099 Say 'Version' ver '</H1> </CENTER><P>' 1100 Say '<A NAME="TOC"></A>' 1101 Say '<HR><CENTER><b>TABLE OF CONTENTS</b> </CENTER><HR><DL>' 1102 End 1103Else 1104 Do 1105 Say '</DL><HR>' 1106 Call footing 'TOC' 1107 End 1108Return 1109 1110/********************************************************************/ 1111Bold: Procedure Expose html_ext 1112Parse Arg line 1113Return '<B>'line'</B>' 1114 1115/********************************************************************/ 1116Italic: Procedure Expose html_ext 1117Parse Arg line 1118Return '<I>'line'</I>' 1119 1120/********************************************************************/ 1121MakeTOC: Procedure Expose infile html_ext 1122Parse Arg keyword,desc 1123Parse Var infile base '.' . 1124last_slash = Lastpos( '/', base ) 1125If last_slash \= 0 Then base = Substr( base, last_slash+1 ) 1126name = RemoveSpaces(SpecialTranslate(keyword)) 1127Return '<A HREF = "'base || html_ext || '#'name'">' keyword '</A>' desc '<BR>' 1128 1129/********************************************************************/ 1130MakeRef: Procedure Expose html_ext 1131Parse Arg trans,extra,keyword 1132Select 1133 When Words(keyword) > 1 & Translate(Word(keyword,1)) = 'SET' Then filename = 'commset' || html_ext 1134 When Words(keyword) > 1 & Translate(Word(keyword,1)) = 'SOS' Then filename = 'commsos' || html_ext 1135 When Words(keyword) > 1 & Translate(Word(keyword,1)) = 'QUERY,' Then filename = 'query' || html_ext 1136 When keyword \= Translate(keyword) Then filename = 'glossary' || html_ext 1137 Otherwise 1138 Do 1139 If keyword = 'REXX' | keyword = 'Rexx' Then filename = 'glossary' || html_ext 1140 else filename = 'comm' || html_ext 1141 End 1142End 1143If trans = 'UPPER' Then name = Strip(SpecialTranslate(keyword),,"'") 1144Else name = Strip(keyword,,"'") 1145name = RemoveSpaces(name) 1146Return '<A HREF = "'filename'#'name'">'||keyword||'</A>'extra 1147 1148/********************************************************************/ 1149heading: Procedure Expose html_ext 1150Parse Arg title 1151Say '<HTML>' 1152Say '<HEAD><TITLE>THE Reference -' title '</TITLE></HEAD>' 1153Say '<BODY BGCOLOR="#F1EDD1" LINK = "#0000FF" VLINK = "#FF0022" ALINK = "#808000">' 1154Say '<CENTER> <img WIDTH="64" HEIGHT="64" HSPACE="20" SRC="the64.png" ALT="THE"> </CENTER>' 1155Return 1156 1157/********************************************************************/ 1158footing: Procedure Expose html_ext 1159Parse Arg src . 1160Say '<ADDRESS>' 1161Say 'The Hessling Editor is Copyright © <A HREF = "http://www.rexx.org/">Mark Hessling</A>, 1990-'Left( Date('S'), 4 ) 1162Say '<<A HREF = "mailto:mark@rexx.org">mark@rexx.org</A>>' 1163Say '<BR>Generated on:' Date() 1164Say '</ADDRESS><HR>' 1165If src \= 'TOC' Then Say 'Return to <A HREF = "index' || html_ext || '#TOC"> Table of Contents </A><BR>' 1166Say '</BODY> </HTML>' 1167Return 1168 1169/********************************************************************/ 1170handle_keywords: Procedure Expose html_ext 1171Parse Arg line,syntax_words 1172tmp = '' 1173Do Forever /* handle links */ 1174 Parse Var line pre '<' keyword '>' line 1175 Select 1176 When Left(keyword,1) = '(' & Right(keyword,1) = ')' Then 1177 Do 1178 tmp = tmp pre '<'Strip(Strip(keyword,'L','('),'T',')')'>' 1179 End 1180 When keyword = '' Then tmp = tmp pre 1181 When Left( keyword, 5 ) = 'http:' Then 1182 Do 1183 tmp = tmp pre '<a href="'keyword'">'keyword'</a>' 1184 End 1185 Otherwise tmp = tmp Strip(pre) MakeRef('UPPER',,keyword) 1186 End 1187 If line = '' Then Leave 1188End 1189line = tmp 1190tmp = '' 1191/* 1192 * Fix mishandling of apostrophes being mistaken for argument names. 1193 */ 1194nondisp = x2c( 'EE' ) 1195line = Changestr( "'", line, nondisp ) 1196line = Changestr( nondisp's ', line, "'s " ) 1197Do Forever /* handle arguments - single words with single quotes*/ 1198 Parse Var line pre (nondisp) keyword (nondisp) line 1199 Select 1200 When keyword = '' Then tmp = tmp pre /* end of line */ 1201 Otherwise 1202 Do 1203 If Words(syntax_words) \= 0 & Wordpos(Translate(keyword),Translate(syntax_words)) = 0 Then 1204 tmp = tmp pre "'"keyword"'" 1205 Else 1206 Do 1207 If pre = '' Then 1208 tmp = tmp pre Italic(keyword) 1209 Else 1210 Do 1211 strip_pre = Strip(pre) 1212 If Substr(strip_pre,Length(strip_pre)) = "#" Then 1213 tmp = tmp pre || keyword 1214 Else 1215 Do 1216 tmp = tmp pre Italic(keyword) 1217 End 1218 1219 End 1220 End 1221 End 1222 End 1223 If line = '' Then Leave 1224End 1225Return tmp 1226 1227/********************************************************************/ 1228SpecialTranslate: Procedure 1229Parse Arg keyword 1230Select 1231 When keyword = '?' Then Return('QUESTIONMARK') 1232 When keyword = '=' Then Return('EQUALSIGN') 1233 When keyword = '!' Then Return('EXCLAIMARK') 1234 When keyword = '&' Then Return('AMPERSAND') 1235 Otherwise Return Translate(keyword) 1236End 1237Return 'WRONG!!' 1238 1239/********************************************************************/ 1240RemoveSpaces: Procedure 1241Parse Arg val 1242retval = '' 1243Do i = 1 To Words(val) 1244 retval = retval || Word(val,i) 1245End 1246Return retval 1247 1248/********************************************************************/ 1249ConvertSpecialChars: Procedure 1250Parse Arg val 1251newval = '' 1252intag = 0 1253Do i = 1 To Length(val) 1254 char = Substr(val,i,1) 1255 Select 1256 When Substr(val,i,2) = '<A' Then 1257 Do 1258 intag = 1 1259 newval = newval || Substr(val,i,2) 1260 i = i + 1 1261 End 1262 When Substr(val,i,4) = '</A>' Then 1263 Do 1264 intag = 0 1265 newval = newval || Substr(val,i,4) 1266 i = i + 3 1267 End 1268 When char = '"' & intag = 0 Then newval = newval || '"' 1269 When char = '>' & intag = 0 Then newval = newval || '>' 1270 When char = '<' & intag = 0 Then newval = newval || '<' 1271 When char = "'" & intag = 0 Then newval = newval || ''' 1272 Otherwise newval = newval || char 1273 End 1274End 1275Return newval 1276