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