function strlist2html, array, ordered=ordered, unordered=unordered, all=all, $ maxsep=maxsep, loud=loud ;+ ; Name: strlist2html ; ; Purpose: identify ordered/unordered lists in string array and cnvt->html ; ; Input Parameters: ; array - string array to search ; ; Keyword Parameters: ; ordered - if set, ordered lists only (default) ; unordered - if set, unordereed lists only ; all - if set, ordered AND unordered lists (recursive) ; maxsep - maximum seperation expected between list entries (def=3 lines) ; loud - if set, print some diagnostics ; ; Calling Sequence: ; list=strlist2html(array [/ordered, /unordered, /all, maxsep=NN] ; ; Restrictions: ; may let some lists slip through the cracks... ; ; History: ; 26-jul-1995 (SLF) - ; 5-mar-1997 (S.L.Freeland ) added /LOUD and made quiet the default ; 09-May-2003, William Thompson - Use ssw_strsplit instead of strsplit ;- loud=keyword_set(loud) if keyword_set(all) then $ ; ** recursive ** return,strlist2html(strlist2html(array,/unordered)) ; ** order/unord ** tohtml=keyword_set(tohtml) or 1 ; *** forced on for now maxchar=([3,1])(keyword_set(unordered)) ; 2digit&1 special or 1 special split=ssw_strsplit(strtrim(array,2),' ') ; extract 1st field case 1 of keyword_set(unordered): nss=strspecial(split) ; "special" character? else: nss=strspecial(split,/digit) ; digit endcase numberss=where(strspecial(split,/last) and nss and $ strlen(split) le (maxchar>1),ncount) ; eliminate bogus single entry "lists" (odd leading characters...) if ncount gt 0 then begin if not keyword_set(maxsep) then maxsep=3 ss=lindgen(ncount) badss=where((abs(numberss-shift(numberss,-1)) gt maxsep) and $ (abs(numberss-shift(numberss,1)) gt maxsep),bcnt) if bcnt gt 0 then ss(badss)=-1 good=where(ss ge 0,ncount) endif levcol=intarr(10)-1 ; nesting depth levn=-1 if ncount le 1 then begin if loud then message,/info, $ "No "+(['','un'])(keyword_set(unordered))+ "ordered lists..." endif else begin numberss=numberss(good) ; numbers=fix(str2number(split(numberss))) ; convert to number ss=strarr(80) ; track indices cp=[-1] for i=0, ncount-1 do begin curcol=strpos(array(numberss(i)),split(numberss(i))) cp=[cp,curcol] del=([',',''])(strlen(ss(curcol)) eq 0) ss(curcol)=ss(curcol) + del + strtrim(numberss(i),2) array(numberss(i))= $ str_replace(array(numberss(i)),split(numberss(i)), '