home *** CD-ROM | disk | FTP | other *** search
/ Magazyn WWW 1999 July / www_07_1999.iso / prez / amiga / KidHTML1_25.lha / KidHTML1.25 / ARexx / rdag2html.rexx next >
OS/2 REXX Batch file  |  1997-01-07  |  17KB  |  728 lines

  1. /*
  2.  *    $VER: rdag2html 2.1b (7.1.1997) Copyright (C) by Michael Ranner
  3.  *    E-Mail: rmike@sbox.tu-graz.ac.at
  4.  *    Homepage: http://www.sbox.tu-graz.ac.at/home/rmike/
  5.  *
  6.  *      Modified by Magnus Holmgren (8.11.96)
  7.  *
  8.  *    This piece of code is Public Domain. Use it, distribute it, modify it!
  9.  *    If you have some useful modifications, please send it to the author!
  10.  */
  11.  
  12. id = pragma('ID')
  13. tmpfile = 't:rdag2html_' || id || '.tmp'
  14.  
  15. call time('E')
  16.  
  17. parse arg arguments
  18.  
  19. template = 'Source/A,Dest/K,SingleFile/S,TOC/K,Index/K,Help/K,Icons/S,' || ,
  20.        'TOCIcon/K,TOCIconDisabled/K,TOCText/K,IndexIcon/K,IndexIconDisabled/K,IndexText/K,' || ,
  21.        'HelpIcon/K,HelpIconDisabled/K,HelpText/K,PrevIcon/K,PrevIconDisabled/K,PrevIconText/K,' || ,
  22.        'NextIcon/K,NextIconDisabled/K,NextText/K,HideDisabledLinks/S,' || ,
  23.        'Background/K,BGColor/K,TextColor/K,LinkColor/K,ALinkColor/K,VLinkColor/K,' || ,
  24.        'FontSize/K,NoHR/S,Header/K,Footer/K,NoLowerCase/S,Suffix/K,8Point3/S,NoStrip/S,' || ,
  25.            'NoInternational/S,ArgFile/K'
  26.  
  27. argArray. = ''
  28. argArray.Source = ''
  29. argArray.Dest   = ''
  30. argArray.SingleFile = 0
  31. argArray.TOC = ''
  32. argArray.Index = ''
  33. argArray.Help = ''
  34. argArray.Icons = 0
  35. argArray.TOCIcon = 'images/content.gif'
  36. argArray.TOCIconDisabled = 'images/dcontent.gif'
  37. argArray.TOCText = '[Contents]'
  38. argArray.IndexIcon = 'images/index.gif'
  39. argArray.IndexIconDisabled = 'images/dindex.gif'
  40. argArray.IndexText = '[Index]'
  41. argArray.HelpIcon = 'images/help.gif'
  42. argArray.HelpIconDisabled = 'images/dhelp.gif'
  43. argArray.HelpText = '[Help]'
  44. argArray.PrevIcon = 'images/prev.gif'
  45. argArray.PrevIconDisabled = 'images/dprev.gif'
  46. argArray.PrevText = '[Browse <]'
  47. argArray.NextIcon = 'images/next.gif'
  48. argArray.NextIconDisabled = 'images/dnext.gif'
  49. argArray.NextText = '[Browse >]'
  50. argArray.HideDisabledLinks = 0
  51. argArray.Background = ''
  52. argArray.BGColor = ''
  53. argArray.TextColor = ''
  54. argArray.LinkColor = ''
  55. argArray.ALinkColor = ''
  56. argArray.VLinkColor = ''
  57. argArray.FontSize = ''
  58. argArray.NoHR = 0
  59. argArray.Header = ''
  60. argArray.Footer = ''
  61. argArray.NoLowerCase = 0
  62. argArray.Suffix = '.html'
  63. argArray.8Point3 = 0
  64. argArray.NoStrip = 0
  65. argArray.NoInternational = 0
  66. argArray.ArgFile = ''
  67.  
  68. rc = MyReadArgs(template, arguments) 
  69.  
  70. if rc ~= 0 then do
  71.     return rc
  72. end
  73.  
  74. if ~existsFile(argArray.Source) then do
  75.     return 205
  76. end
  77.  
  78. header = ''
  79. comment = 'Converted on ' || date() || ' with RexxDoesAmigaGuide2HTML 2.1 by Michael Ranner.'
  80. footer  = 'Converted on ' || date() || ' with RexxDoesAmigaGuide2HTML 2.1 by <A HREF="http://www.sbox.tu-graz.ac.at/home/rmike">Michael Ranner</A>.</P>'
  81.  
  82. if argArray.Dest = '' & argArray.SingleFile then argArray.Dest = 'out.html'
  83.  
  84. if argArray.8Point3 then argArray.Suffix = '.htm'
  85.  
  86. if argArray.ArgFile ~= '' then do
  87.     if ~existsFile(argArray.ArgFile) then do
  88.         return 205
  89.     end
  90.  
  91.     call open 'ArgFile', argArray.ArgFile, 'R'
  92.  
  93.     do while ~eof('ArgFile')
  94.         interpret readln('ArgFile')
  95.     end
  96.  
  97.     call close('ArgFile')
  98. end
  99.  
  100. if argArray.Header ~= '' then do
  101.     if ~existsFile(argArray.Header) then do
  102.         return 205
  103.     end
  104.  
  105.     call open 'Header', argArray.Header, 'R'
  106.     header = readFile('Header')
  107.     call close('Header')
  108. end
  109.  
  110. if argArray.Footer ~= '' then do
  111.     if ~existsFile(argArray.Footer) then do
  112.         return 205
  113.     end
  114.  
  115.     call open 'Footer', argArray.Footer, 'R'
  116.     footer = readFile('Footer')
  117.     call close('Footer')
  118. end
  119.  
  120. if argArray.Icons then do
  121.     tocA = '<IMG SRC="'argArray.TOCIcon'" ALT="'argArray.TOCText'" BORDER="0">'
  122.     dtocA = '<IMG SRC="'argArray.TOCIconDisabled'" ALT="'argArray.TOCText'">'
  123.     indexA = '<IMG SRC="'argArray.IndexIcon'" ALT="'argArray.IndexText'" BORDER="0">'
  124.     dindexA = '<IMG SRC="'argArray.IndexIconDisabled'" ALT="'argArray.IndexText'">'
  125.     helpA = '<IMG SRC="'argArray.HelpIcon'" ALT="'argArray.HelpText'" BORDER="0">'
  126.     dhelpA = '<IMG SRC="'argArray.HelpIconDisabled'" ALT="'argArray.HelpText'">'
  127.     prevA = '<IMG SRC="'argArray.PrevIcon'" ALT="'argArray.PrevText'" BORDER="0">'
  128.     dprevA = '<IMG SRC="'argArray.PrevIconDisabled'" ALT="'argArray.PrevText'">'
  129.     nextA = '<IMG SRC="'argArray.NextIcon'" ALT="'argArray.NextText'" BORDER="0">'
  130.     dnextA = '<IMG SRC="'argArray.NextIconDisabled'" ALT="'argArray.NextText'">'
  131. end
  132. else do
  133.     tocA = argArray.TOCText
  134.     dtocA = tocA
  135.     indexA = argArray.IndexText
  136.     dindexA = indexA
  137.     helpA = argArray.HelpText
  138.     dhelpA = helpA
  139.     prevA = argArray.PrevText
  140.     dprevA = prevA
  141.     nextA = argArray.NextText
  142.     dnextA = nextA
  143. end
  144.  
  145. if argArray.HideDisabledLinks then do
  146.     dtocA = ''
  147.     dindexA = ''
  148.     dhelpA = ''
  149.     dprevA = ''
  150.     dnextA = ''
  151. end
  152.  
  153. /* Scanning for nodes */
  154.  
  155. say 'Scanning for nodes...'
  156.  
  157. i = 0
  158.  
  159. address command 'Search' argArray.Source 'nonum @NODE >' || tmpfile
  160.  
  161. call open 'NodeList', tmpfile, 'R'
  162.  
  163. do until eof('NodeList')
  164.     line = readln('NodeList')
  165.  
  166.     if upper(word(line, 1)) = '@NODE' then do
  167.         i = i + 1
  168.         nodes.i = getNode(line)
  169.     end
  170. end
  171.  
  172. call close('NodeList')
  173. address command 'Delete' tmpfile '>NIL:'
  174.  
  175. /* Initialize some variables used in the main loop */
  176.  
  177. nodes.0 = i
  178. nextNodeNum = 1
  179. currentNode = ''
  180. destination. = ''
  181. workingOnNode = 0
  182. oldDir = ''
  183.  
  184. /* Main */
  185.  
  186. call open 'Guide', argArray.Source, 'R'
  187. srcline = readln('Guide')
  188.  
  189. if upper(word(srcline, 1)) ~= '@DATABASE' then do
  190.     say "That's not an AmigaGuide file!"
  191.     return 10
  192. end
  193.  
  194. if argArray.SingleFile then do
  195.     call open 'HTML', argArray.Dest, 'W'
  196.     call writeHeader word(srcline, 2), comment, header
  197. end
  198. else if argArray.Dest ~= '' then do
  199.     oldDir = pragma('D', argArray.Dest)
  200. end
  201.  
  202. do until eof('Guide')
  203.     srcline = readln('Guide')
  204.     srcline = replaceString('&', '&', srcline)
  205.     /* srcline = replaceString('<', '<', srcline) */
  206.     /* srcline = replaceString('>', '>', srcline) */
  207.     srcline = replaceString('\\', '\', srcline)
  208.  
  209.     if pos('@', srcline) > 0 then do
  210.         srcline = replaceString('\@', '@', srcline)
  211.         token = upper(word(srcline, 1))
  212.  
  213.         select
  214.             when token = '@AUTHOR' then do
  215.                 say 'Author: ' || subword(srcline, 2)
  216.             end
  217.  
  218.             when token = '@$VER:' then do
  219.                 say 'Version: ' || subword(srcline, 2)
  220.             end
  221.  
  222.             when token = '@REMARK' | token = '@REM' then do
  223.                 say 'Remark: ' || subword(srcline, 2)
  224.             end
  225.  
  226.             when token = '@NODE' then do
  227.                 n = 0
  228.                 workingOnNode = 1
  229.  
  230.                 if nextNodeNum < nodes.0 then do
  231.                     nextNodeNum = nextNodeNum + 1
  232.                     nextNode = nodes.nextNodeNum
  233.                 end
  234.                 else nextNode = ''
  235.  
  236.                 prevNode = currentNode
  237.                 currentNode = getNode(srcline)
  238.                 currentHTMLDoc = currentNode || argArray.Suffix
  239.                 nodeTitle = getTitle(srcLine)
  240.  
  241.                 if upper(currentNode) = 'MAIN' then do
  242.                     currentNode = 'main'
  243.                 end
  244.  
  245.                 say 'Node:' currentNode
  246.  
  247.                 if ~argArray.SingleFile then do
  248.                     call open 'HTML', currentHTMLDoc, 'W'
  249.  
  250.                     if currentNode = 'main' & argArray.TOC ~= '' then do
  251.                         _tocURL = argArray.TOC
  252.                     end
  253.                     else do
  254.                         _tocURL = 'main'argArray.Suffix
  255.                     end
  256.  
  257.                     _indexURL = argArray.Index
  258.                     _helpURL = argArray.Help
  259.                 end
  260.             end
  261.  
  262.             when token = '@TOC' & argArray.TOC = '' then do
  263.                 _tocURL = getNode(srcline) || argArray.Suffix
  264.             end
  265.  
  266.             when token = '@INDEX' & argArray.Index = '' then do
  267.                 _indexURL = getNode(srcline) || argArray.Suffix
  268.             end
  269.  
  270.             when token = '@HELP' & argArray.Help = '' then do
  271.                 _helpURL = getNode(srcline) || argArray.Suffix
  272.             end
  273.  
  274.             when token = '@NEXT' then do
  275.                 nextNode = getNode(srcline)
  276.             end
  277.  
  278.             when token = '@PREV' then do
  279.                 prevNode = getNode(srcline)
  280.             end
  281.  
  282.             when token = '@ENDNODE' then do
  283.  
  284.                 if argArray.SingleFile then do
  285.                     call writech 'HTML', '<A NAME="' || currentNode || '">'
  286.  
  287.                     if nodeTitle ~= '' then do
  288.                         call writech 'HTML', '<H3>'nodeTitle'</H3>'
  289.                     end
  290.  
  291.                     call writeln 'HTML', '</A>'
  292.                     call writech 'HTML', '<PRE>'
  293.                 end
  294.                 else do
  295.                     call writeHeader nodeTitle, comment, header
  296.  
  297.                     if _tocURL ~= currentHTMLDoc then do
  298.                         call writeln 'HTML', '<A HREF="'_tocURL'">'tocA'</A>'
  299.                     end
  300.                     else do
  301.                         call writeln 'HTML', dtocA
  302.                     end
  303.  
  304.                     if _indexURL ~= '' & _indexURL ~= currentHTMLDoc then do
  305.                         call writeln 'HTML', '<A HREF="'_indexURL'">'indexA'</A>'
  306.                     end
  307.                     else do
  308.                         call writeln 'HTML', dindexA
  309.                     end
  310.  
  311.                     if _helpURL ~= '' & _helpURL ~= currentHTMLDoc then do
  312.                         call writeln 'HTML', '<A HREF="'_helpURL'">'helpA'</A>'
  313.                     end
  314.                     else do
  315.                         call writeln 'HTML', dhelpA
  316.                     end
  317.  
  318.                     if prevNode ~= '' then do
  319.                         call writeln 'HTML', '<A HREF="'prevNode || argArray.Suffix'">'prevA'</A>'
  320.                     end
  321.                     else do
  322.                         call writeln 'HTML', dprevA
  323.                     end
  324.  
  325.                     if nextNode ~= '' then do
  326.                         call writeln 'HTML', '<A HREF="'nextNode || argArray.Suffix'">'nextA'</A>'
  327.                     end
  328.                     else do
  329.                         call writeln 'HTML', dnextA
  330.                     end
  331.  
  332.                     call writech 'HTML', '<HR><PRE>'
  333.                 end
  334.  
  335.                 if argArray.FontSize ~= '' then do
  336.                     call writech 'HTML', '<FONT SIZE="'argArray.FontSize'">'
  337.                 end
  338.  
  339.                 do i = 0 to n
  340.                     call writeln 'HTML', destination.i
  341.                 end
  342.  
  343.                 if argArray.FontSize ~= '' then do
  344.                     call writech 'HTML', '</FONT>'
  345.                 end
  346.  
  347.                 if argArray.SingleFile then do
  348.  
  349.                     if argArray.NoHR then do
  350.                         call writeln 'HTML', '</PRE>'
  351.                     end
  352.                     else do
  353.                         call writeln 'HTML', '</PRE><P><HR>'
  354.                     end
  355.  
  356.                 end
  357.                 else do
  358.  
  359.                     if argArray.NoHR then do
  360.                         call writeln 'HTML', '</PRE>'
  361.                     end
  362.                     else do
  363.                         call writeln 'HTML', '</PRE><HR>'
  364.                     end
  365.                         
  366.                     call writeFooter(footer)
  367.                     call close('HTML')
  368.                 end
  369.  
  370.                 workingOnNode = 0
  371.             end
  372.  
  373.             otherwise do
  374.                 dstline = ''
  375.  
  376.                 do while srcline ~= ''
  377.                     parse var srcline start '@{' text '}' srcline
  378.                     token = upper(text)
  379.                     start = replaceString('<', '<', start)
  380.                     start = replaceString('>', '>', start)
  381.  
  382.                     select
  383.                         when token = 'AMIGAGUIDE' then do
  384.                             dstline = dstline || start || '<B>AmigaGuide</B>®'
  385.                         end
  386.  
  387.                         when token = 'I' then do
  388.                             dstline = dstline || start || '<I>'
  389.                         end
  390.  
  391.                         when token = 'UI' then do
  392.                             dstline = dstline || start || '</I>'
  393.                         end
  394.  
  395.                         when token = 'B' then do
  396.                             dstline = dstline || start || '<B>'
  397.                         end
  398.  
  399.                         when token = 'UB' then do
  400.                             dstline = dstline || start || '</B>'
  401.                         end
  402.  
  403.                         when token = 'U' then do
  404.                             dstline = dstline || start || '<U>'
  405.                         end
  406.  
  407.                         when token = 'UU' then do
  408.                             dstline = dstline || start || '</U>'
  409.                         end
  410.  
  411.                         when abbrev(token, '!') then do
  412.                             dstline = dstline || start || right(text, length(text) - 1)
  413.                         end
  414.  
  415.                         otherwise do
  416.                             parse var text '"' name '"' token node
  417.  
  418.                             if pos('"', node) ~= 0 then parse var node '"'node'"' destLineNumber .
  419.                             else parse var node node destLineNumber
  420.  
  421.                             token = upper(token)
  422.                             node = compress(node, ' "')
  423.  
  424.                             if argArray.NoInternational then do
  425.                                 node = replaceString('─', 'Ae', node)
  426.                                 node = replaceString('╓', 'Oe', node)
  427.                                 node = replaceString('▄', 'Ue', node)
  428.                                 node = replaceString('Σ', 'ae', node)
  429.                                 node = replaceString('÷', 'oe', node)
  430.                                 node = replaceString('ⁿ', 'ue', node)
  431.                                 node = replaceString('▀', 'ss', node)
  432.                             end
  433.  
  434.                             if ~argArray.NoLowerCase then do
  435.                                 node = lowerCase(node)
  436.                             end
  437.  
  438.                             if ~argArray.NoStrip then do
  439.                                 node = stripNode(node)
  440.                             end
  441.  
  442.                             if token = 'LINK' then do
  443.                                 if argArray.SingleFile = 1 then do
  444.                                     dstline = dstline || start || '<A HREF="#' || node || '">' || name || '</A>'
  445.                                 end
  446.                                 else do
  447.                                     dstline = dstline || start || '<A HREF="' || node || argArray.Suffix || '">' || name || '</A>'
  448.                                 end
  449.                             end
  450.                             else do
  451.                                 dstline = dstline || start
  452.                             end
  453.                         end
  454.                     end
  455.                 end
  456.  
  457.                 if workingOnNode & ~abbrev(dstline, '@') then do
  458.                     n = n + 1
  459.                     destination.n = dstline
  460.                 end
  461.             end
  462.         end
  463.     end
  464.     else do
  465.         if workingOnNode then do
  466.             n = n + 1
  467.             destination.n = srcline
  468.         end
  469.     end
  470. end
  471.  
  472. if argArray.SingleFile then do
  473.     call writeFooter(footer)
  474.     call close('HTML')
  475. end
  476.  
  477. call close('Guide')
  478.  
  479. if oldDir ~= '' then do
  480.     pragma('D', oldDir)
  481. end
  482.  
  483. say 'Time elapsed:' time('E')
  484.  
  485. exit
  486.  
  487. /* Parse the argument string */
  488.  
  489. MyReadArgs: procedure expose argArray.
  490.  
  491.     parse arg template, string
  492.     string = strip(string, 'T')
  493.  
  494.     if right(string, 1) = '?' then do
  495.         string = left(string, length(string) - 1)
  496.         call writech 'STDOUT', template': '
  497.         string = string || readln('STDOUT')
  498.     end
  499.  
  500.     upString = upper(string)
  501.  
  502.     do while template ~= ''
  503.         parse upper var template parameter'/'key','template
  504.  
  505.         value = ''
  506.         i = find(upString, parameter)
  507.  
  508.         if i > 0 then do
  509.             select
  510.                 when key = "S" then do
  511.                     value = 1
  512.                 end
  513.  
  514.                 when (key = "K") | (key = "A") then do
  515.                     value = word(string, i + 1)
  516.  
  517.                     if pos('"', value) ~= 0 then do
  518.                         value = subword(string, i + 1)
  519.                         parse var value '"'value'"' .
  520.                     end
  521.                 end
  522.  
  523.                 when key = "N" then do
  524.                     value = word(string, i + 1)
  525.                 end
  526.  
  527.                 otherwise nop
  528.             end
  529.         end
  530.  
  531.         if (key = 'A') & (value = '') then do
  532.             value = word(string, 1)
  533.  
  534.             if pos('"', value) ~= 0 then do
  535.                 value = subword(string, i + 1)
  536.                 parse var value '"'value'"' .
  537.             end
  538.  
  539.             if value = '' then do
  540.                 say "Missing argument"
  541.                 return 116
  542.             end
  543.         end
  544.  
  545.         if value ~= '' then do
  546.             argArray.parameter = value
  547.         end
  548.  
  549.         /* say "Parameter" parameter "Key" key "Value" argArray.parameter */
  550.     end
  551.  
  552.     return 0
  553.  
  554. /* Check if file exists */
  555.  
  556. existsFile:
  557.     if ~exists(arg(1)) then do
  558.         say arg(1) "not found"
  559.         return 0
  560.     end
  561.     else do
  562.         return 1
  563.     end
  564.  
  565. /* Replace char/substring in string */
  566.  
  567. replaceString:
  568.     parse arg old, new, string
  569.  
  570.     if pos(old, string) > 0 then do
  571.         parse var string begin(old)end
  572.         return begin || new || replaceString(old, new, end)
  573.     end
  574.  
  575.     return string
  576.  
  577. /* Procedures for header and footer */
  578.  
  579. writeHeader: procedure expose argArray.
  580.     parse arg title, comment, header
  581.  
  582.     call writeln 'HTML', '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'
  583.     call writeln 'HTML', '<!-- ' || comment || ' -->'
  584.     call writeln 'HTML', '<HTML>'
  585.     call writeln 'HTML', '<HEAD>'
  586.     call writeln 'HTML', '<TITLE>' || title || '</TITLE>'
  587.     call writeln 'HTML', '</HEAD>'
  588.     call writech 'HTML', '<BODY'
  589.  
  590.     if argArray.Background ~= '' then do
  591.         call writech 'HTML', ' BACKGROUND="'argArray.Background'"'
  592.     end
  593.  
  594.     if argArray.BGColor ~= '' then do
  595.         call writech 'HTML', ' BGCOLOR="'argArray.BGColor'"'
  596.     end
  597.  
  598.     if argArray.TextColor ~= '' then do
  599.         call writech 'HTML', ' TEXT="'argArray.TextColor'"'
  600.     end
  601.  
  602.     if argArray.LinkColor ~= '' then do
  603.         call writech 'HTML', ' LINK="'argArray.LinkColor'"'
  604.     end
  605.  
  606.     if argArray.ALinkColor ~= '' then do
  607.         call writech 'HTML', ' ALINK="'argArray.ALinkColor'"'
  608.     end
  609.  
  610.     if argArray.VLinkColor ~= '' then do
  611.         call writech 'HTML', ' VLINK="'argArray.VLinkColor'"'
  612.     end
  613.  
  614.     call writeln 'HTML', '>'
  615.  
  616.     call writeln 'HTML', header
  617.     return 0
  618.  
  619. writeFooter: procedure
  620.     parse arg footer
  621.  
  622.     call writeln 'HTML', footer
  623.     call writeln 'HTML','</BODY></HTML>' 
  624.     return 0
  625.  
  626. /* Read the content of a small file */
  627.  
  628. readFile: procedure
  629.     parse arg file
  630.  
  631.     string = ''
  632.  
  633.     do until eof(file)
  634.         string = string || readln(file) || '0A'X
  635.     end
  636.  
  637.     return string
  638.  
  639. /* Make string lower case */
  640.  
  641. lowerCase:
  642.     return translate(arg(1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  643.  
  644. /* Get the node from a '@NODE' string */
  645.  
  646. getNode: procedure expose argArray.
  647.     parse arg string
  648.  
  649.     if pos('"', word(string, 2)) > 0 then do
  650.         parse var string '"'node'"' .
  651.     end
  652.     else do
  653.         node = word(string, 2)
  654.     end
  655.  
  656.     node = compress(node, ' "')
  657.  
  658.     if ~argArray.NoLowerCase then do
  659.         node = lowerCase(node)
  660.     end
  661.  
  662.     if ~argArray.NoStrip then do
  663.         node = stripNode(node)
  664.     end
  665.  
  666.     if argArray.NoInternational then do
  667.         node = replaceString('─', 'Ae', node)
  668.         node = replaceString('╓', 'Oe', node)
  669.         node = replaceString('▄', 'Ue', node)
  670.         node = replaceString('Σ', 'ae', node)
  671.         node = replaceString('÷', 'oe', node)
  672.         node = replaceString('ⁿ', 'ue', node)
  673.         node = replaceString('▀', 'ss', node)
  674.     end
  675.  
  676.     return node
  677.  
  678. /* Get the title from a '@NODE' string */
  679.  
  680. getTitle: procedure
  681.     parse arg string
  682.  
  683.     if pos('"', word(string, 2)) > 0 then do
  684.         parse var string '"'node'"' title
  685.     end
  686.     else do
  687.         title = subword(string, 3)
  688.     end
  689.  
  690.     return strip(compress(title,'"'), 'B')
  691.  
  692. /* Strip nodes down */
  693.  
  694. stripNode: procedure expose argArray.
  695.     parse arg name
  696.  
  697.     strlen = length(name)
  698.  
  699.     if argArray.8Point3 then do
  700.         select
  701.             when (strlen > 8) & (strlen < 16) then do
  702.                 name = left(name, 16 - strlen) || right(name, strlen - 8)
  703.             end
  704.  
  705.             when (strlen >= 16) then do
  706.                 name = left(name, 1) || right(name, 7)
  707.             end
  708.  
  709.             otherwise nop
  710.         end
  711.     end
  712.     else do
  713.         select
  714.             when (strlen > 25) & (strlen < 50) then do
  715.                 name = left(name, 50 - strlen) || right(name, strlen - 25)
  716.             end
  717.  
  718.             when (strlen >= 50) then do
  719.                 name = left(name, 1) || right(name, 24)
  720.             end
  721.  
  722.             otherwise nop
  723.         end
  724.     end
  725.  
  726.     return name
  727.  
  728.