;+
;NAME:
;	go_mk_idl_doc
;PURPOSE:
;	To generate the WWW IDL document pages
;HISTORY:
;	Written 28-May-97 by M.Morrison (generalizing mk_idl_doc)
;	11-Jun-97 (MDM) - Reorganized.  Had "doc1liners" called within
;			  this driver routine
;	 1-Aug-97 (MDM) - Added <pre> to topssw output
;	 4-Dec-97 (MDM) - Changed to /www instead of /hosts/pore1/...
;	29-Apr-98 (MDM) - Removed "http://www.space.lockheed.com" portion
;			  of "httpdir"
;	 6-Jul-98 (MDM) - Re-added "http://www.lmsal.com" portion of
;			  "httpdir" since "str2html" doesn't work right
;			  otherwise and apparently the web page has been
;			  broken since Apr-98 (guess nobody uses it)
;-
;
dir = '/www/SSW/idl/'
dir ='/net/diapason/data17/solarsoft/idldoc'
httpdir = 'http://www.lmsal.com/solarsoft/idldoc'
;
;
;ssw_path, /all
setenv,'SSW_TRACE=/ssw/trace'
setenv,'SSW_LPARL=/ssw/packages/lparl'
ssw_path, /yohkoh, /sxt, /eit, /trace, /lparl
;

if (n_elements(branches) eq 0) then branches = ['/ssw/gen', '/ssw/soho/gen', $
		'/ssw/trace', $
		'/ssw/soho/mdi', '/soho/eit', $
		'/yohkoh/gen', '/yohkoh/sxt', $
		'/ssw/packages']
if (keyword_set(qdebug)) then branches = ['/ssw/gen/idl/io', '/ssw/gen/idl/help']
;if (keyword_set(qdebug)) then branches = ['/ssw/gen/idl/io', '/ssw/trace']
;
outarr2 = ''
for i=0,n_elements(branches)-1 do begin
    path_arr = str2arr(!path, delim=':')
    ss = where(strpos(path_arr, branches(i)) ne -1)
    path_do = path_arr(ss)
    outdir = branches(i)
    outdir = str_replace(outdir, '/ssw', '')
    if (strmid(outdir,0,1) eq '/') then outdir = strmid(outdir, 1, 99)
    outdir = str_replace(outdir, '/', '_')
    outarr = '<pre>'
    for j=0,n_elements(path_do)-1 do begin
	path0 = path_do(j)
	lab = path0
	lab = str_replace(lab, '/ssw_sxt1', '/ssw')
	lab = str_replace(lab, '/ssw/', '')
	lab = 'ssw_' + str_replace(lab, '/', '_')
	lab2 = '/' + str_replace(lab, '_', '/')
	outarr2 = [outarr2, $
		'<A HREF="' + lab + '.html' + '"><B>' + lab2 + '</B></A><br>']
	tabfil = lab + '.tab'
	file_delete, concat_dir(dir, tabfil)
	doc1liners, path0, concat_dir(dir, tabfil), /doc
	mk_idl_doc, dir, httpdir, tabfil, outdir, outarr0
	if (n_elements(outarr0) gt 2) then outarr0 = outarr0(2:*)
	outarr = [outarr, outarr0]
    end
    outarr2 = [outarr2, '<br>']

    toptit = '/ssw/' + str_replace(outdir, '_', '/')
    topout = concat_dir(dir, 'topssw_' + outdir+'.html')
    file_delete, topout
    html_basics, topout, title=toptit, /head
    file_append, topout, outarr
    html_basics, topout, /trail
end

prstr, outarr2, file=concat_dir(dir, 'index_part2.html')
html_temp2out, concat_dir(dir, 'index.thtml'), concat_dir(dir, 'index.html')

;---- Manually created one-liner lists

mk_idl_doc, dir, httpdir, '1liners_trace_mdi.tab', 'mdi_trace'
mk_idl_doc, dir, httpdir, '1liners_yohkoh.tab', 'yohkoh'

;mk_idl_doc, dir, httpdir, 'ssw_gen.tab', 	'gen', 		path='/ssw/gen'
;mk_idl_doc, dir, httpdir, 'ssw_soho.tab', 	'soho', 	path='/ssw/soho/gen'
;mk_idl_doc, dir, httpdir, 'ssw_soho_mdi.tab', 	'soho_mdi', 	path='/ssw/soho/mdi'
;mk_idl_doc, dir, httpdir, 'ssw_soho_eit.tab', 	'soho_eit', 	path='/soho/eit/'
;mk_idl_doc, dir, httpdir, 'ssw_yohkoh.tab', 	'yohkoh', 	path='/yohkoh/gen/'
;mk_idl_doc, dir, httpdir, 'ssw_yohkoh_sxt.tab', 'yohkoh_sxt', 	path='/yohkoh/sxt/'
;mk_idl_doc, dir, httpdir, 'ssw_packages.tab', 	'packages', 	path='/packages/'

end
