The minimum things that an HTML page needs are the HTML and BODY tags. I typically use some basic HTML formatting, so I'd just go with something like:
LIBRARY rexxgui
directoryname = ''
err = guifile('directoryName', 'BROWSE|DRIVES', 'Where to find text files:')
IF err == '' THEN DO
err = dohtml(directoryname, 1)
IF err \== "" THEN SAY err
END
RETURN
dohtml: PROCEDURE EXPOSE
DO UNTIL err \== ""
err = MATCHNAME(ARG(2), 'name', ARG(1) || '\*.*', 'DSNHCRAT', 'NS')
IF err == "" THEN DO
IF name.0 == "" THEN DO
err = dohtml(ARG(1) || '\' || NAME, ARG(2) + 1)
IF err \== "" THEN SIGNAL badnames
END
ELSE DO
UPPER NAME
IF RIGHT(NAME, 4) == ".TXT" THEN DO
htmname = EDITNAME(ARG(1) || '\' || NAME, '*.htm')
STREAM(htmname, 'C', 'OPEN WRITE REPLACE')
LINEOUT(htmname, "<HTML><HEAD><TITLE>" || NAME || "</TITLE></HEAD><BODY TEXT=BLACK BGCOLOR=WHITE><PRE>")
LOADTEXT('lines.', ARG(1) || '\' || name)
LOADTEXT('lines.', htmname, 'S')
LINEOUT(htmname, "</PRE></BODY></HTML>")
STREAM(htmname, 'C', 'CLOSE')
END
END
END
CATCH NOTREADY
RETURN STREAM(htmname, 'D')
END
IF err == 'DONE' THEN err = ""
badnames:
RETURN err The HTM file produced above will not "flow" when you resize the browser window. If you want the text to flow, you'll need to do something fancier. Remove the PRE and /PRE tags, and go through the loaded text file inserting a P tag wherever a new paragraph should begin. |