home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / text / FAQ / bonus / faq_createhtml_byKL.rexx < prev    next >
OS/2 REXX Batch file  |  1995-10-10  |  2KB  |  77 lines

  1. /*  ARexx skript, erzeugt HTML aus FAQ-Liste
  2.     $VER: faq_createhtml.rexx 0.1 (05.08.95) ©1995 Khamsonh Marcel Khounlivong
  3.     - FAQ.html ist Haupt-Dokument
  4.     */
  5.  
  6. PARSE ARG listfile textdir
  7.  
  8. listfile = Strip(listfile)
  9.  
  10. newsgroup = SubStr(listfile,1,LastPos('.files',listfile))'answers'
  11. IF (Pos('/',newsgroup) ~= 0) THEN
  12.     newsgroup = SubStr(newsgroup,LastPos('/',newsgroup)+1)
  13.  
  14. enter = '0a'x
  15.  
  16. if (~Open(infile,listfile,r)) THEN DO
  17.     SAY "Can't open"listfile
  18.     EXIT 20
  19.     END
  20.  
  21. SAY '<html>'enter
  22. SAY '<!  'newsgroup' document (automagic proceeded)'
  23. SAY '    $VER: newsgroups-'newsgroup'.html ('date()')'enter
  24.  
  25. SAY '    (c) Meeting Pearls Group'
  26. SAY '    Script-author: Khamsonh Marcel ''ninji'' Khounlivong>'enter
  27.  
  28. SAY '<head><title>'newsgroup'</title></head>'enter
  29.  
  30. SAY '<body background="../.pix/FAQbg.gif'
  31. SAY '    bgcolor="#aaaaaa'
  32. SAY '    text="#000000'
  33. SAY '    link="#778899'
  34. SAY '    vlink="#334455'
  35. SAY '    alink="#667788>'
  36.  
  37. archive = Word(ReadLn(infile),1)
  38. CALL gettopic
  39.  
  40. DO WHILE (~Eof(infile))
  41.     topic.1 = topic.2
  42.     SAY '<h4>'topic.1'</h4>'enter
  43.     DO WHILE (topic.2 == topic.1 & ~Eof(infile))
  44.  
  45.         dir.2 = SubStr(archive,1,LastPos('/',archive))
  46.         dir.1 = dir.2
  47.         SAY '<dl><dd><b>'dir.2'</b><br>'
  48.         eintrag = ''
  49.         DO i = 0 WHILE (dir.2 == dir.1 & ~Eof(infile))
  50.             eintrag = eintrag'    <a href="FAQ/'archive'">'SubStr(archive,LastPos('/',archive)+1)'</a>'enter
  51.             archive = Word(ReadLn(infile),1)
  52.             IF (~Eof(infile)) THEN dir.2 = SubStr(archive,1,LastPos('/',archive))
  53.             END
  54.         SAY eintrag'    </dl>'enter
  55.         CALL gettopic
  56.         END
  57.     END
  58.  
  59. CALL Close(infile)
  60.  
  61. SAY '</body>'enter
  62. SAY '</html>'
  63.  
  64. EXIT
  65.  
  66. gettopic:
  67.     DO UNTIL (position ~= 0 | Eof(infile))
  68.         position = Pos('/',archive)
  69.         DO WHILE (position == 0 & ~Eof(infile))
  70.             SAY '<h4><a href="FAQ/'archive'">'archive'</a></h4>'enter
  71.             archive = Word(ReadLn(infile),1)
  72.             IF ~Eof(infile) THEN position = Pos('/',archive)
  73.             END
  74.         IF ~Eof(infile) THEN topic.2 = SubStr(archive,1,position-1)
  75.         END
  76.     RETURN
  77.