DEFINT a-z
DECLARE FUNCTION trimhtml$(text$)
FUNCTION PBMAIN()
File$ = TRIM$(COMMAND$)
IF File$ = "" OR DIR$(File$)="" THEN
PRINT "strip "
PRINT "removes HTML code from a text file"
EXIT FUNCTION
END IF
x$ = DIR$(File$)
DIM filedata$(1 TO 1000) 'max 1000 lines of text
DO
IF x$ = "" THEN EXIT DO
PRINT x$ 'disp filename
'suck in file
OPEN x$ FOR INPUT AS #1
lines=0
DO UNTIL EOF(1)
lines=lines+1
LINE INPUT #1, filedata$(lines)
LOOP
CLOSE #1
'pump it out and hope it doesn't crash
OPEN x$ FOR OUTPUT AS #1
FOR r=1 TO lines
PRINT #1, trimhtml$(filedata$(r))
NEXT
CLOSE #1
x$ = DIR$
LOOP
END FUNCTION
FUNCTION trimhtml$(text$)
'removes html code from text$
'NOTE: routine is brute force and will remove more than it needs
' to in many cases where improper tags are used
hstart=INSTR(text$,"<")
hend=INSTR(text$,">")
IF hend<>0 AND hend"))>1 THEN
temp$=trimhtml$(temp$) 'wu hoo recursive
END IF
trimhtml$=temp$
END FUNCTION