#$Id: s.makeDoc.xotcl 1.10 01/03/23 22:07:19+01:00 neumann@somewhere.wu-wien.ac.at $

@ @File {
  description {
    Documentation tool for the XOTcl distribution.<br>
    Usage: 'makeDoc docdir filename ?filename ...?'<br>
    Called by Makefile.
  }
}
package require xotcl::xodoc

set fileList ""

puts "XOTcl Documentation Tool"
puts "------------------------"
if {$argc > 1} {
  set DOCDIR [lindex $argv 0]
  puts "Documenting to directory $DOCDIR:"
  if {[set tcl_platform(platform)] == "windows"} {
    set files ""
    foreach f [lrange $argv 1 end] {
      eval lappend files [glob -nocomplain $f]
    }
  } else {
    set files [lrange $argv 1 end]
  }
  foreach file $files {
    puts "...$file"
    set fb [XODoc documentFileAsHTML $file $DOCDIR]
    lappend fileList $file $fb
  }
} else {
  error "usage: xodoc docdir filename ?filename ...?"
}

set filesHtml ""
set filesDir ""
## write index page
foreach {f fb} $fileList {
  set dir .
  regexp {^(.*)/[^/]*$} $f _ dir
  if {$fb != "langRef-xotcl"} {
    set tail ", "
    if {$dir != $filesDir} {
      append filesHtml "<li> <b>Directory '$dir': </b><br>"
      set filesDir $dir
      set tail ""
    }
    append filesHtml "$tail<a HREF=\"./${fb}.html\">[file tail $f]</a>"
  }
}

#  <html>
#  <head>
#  <title>XOTcl - Documentation</title>
#  </head>
#  <body bgcolor=FFFFFF>
#  <h1><IMG ALIGN=MIDDLE SRC = "./logo-100.jpg">Lanuage Reference - Index</h1>

set content {

The <EM>Extended Object Tcl (XOTcl)</EM> Documentation contains the
following parts: 

<h2> XOTcl Language Documentation </h2>
  <UL>
  <LI><a href="tutorial.html">XOTcl Tutorial</a>
  <LI><a href="langRef-xotcl.html">Language Reference</a>
  <LI>If you have question, problems etc. you might check the
      <a href="http://alice.wu-wien.ac.at/pipermail/xotcl/">archives</a> of the 
      <a href="http://alice.wu-wien.ac.at/mailman/listinfo/xotcl">XOTcl 
         mailing list</a>.
   </UL>

<h2>Package and Script Documentation</h2>
<center>
  This section of the documentation is under work...
</center>

  <ul>
    $filesHtml
  </ul>
  <p>

<h2>Tcl Online Information </h2>
  <ul>
   <li>Online information for <a href="http://dev.scriptics.com/man/">
      Tcl 8.3</a>
  </ul>
 
}


set content [subst -nobackslashes -nocommands $content]
set f [open $DOCDIR/index.html w]
puts $f $content
close $f

puts "Documentation finished"
