This is just a
fast little program I wrote in
Qbasic for my own uses. But then I thought there must be other
noders that do the same thing I do. I don't know about you but when I am
writing E-mails I always find myself wanting to put
links to everything in them. So I decided to write a program that converts
Everythingeses to
HTML (ie [ ] to links). It is in
Qbasic, I think most
win95 computers come with
Qbasic. To run the program, just copy it to a
text file, then open that
text file in
Qbasic. Don't copy it to
Qbasic because it won't copy properly. You can post
Patches or
/msg me if you find
any problems.
DECLARE FUNCTION everything2html$ (words$)
DECLARE FUNCTION makelink$ (words$)
CLS
rFileName$ = "Input File goes here"
wFileName$ = "Output File goes here"
readme = FREEFILE
OPEN rFileName$ FOR INPUT AS readme
writeme = FREEFILE
OPEN wFileName$ FOR OUTPUT AS writeme
DO
LINE INPUT #readme, In$
PRINT #writeme, everything2html$(In$)
LOOP UNTIL EOF(readme)
CLOSE readme
CLOSE writeme
SYSTEM
FUNCTION everything2html$ (words$)
link = 0
link$ = ""
out$ = ""
FOR a = 1 TO LEN(words$)
IF MID$(words$, a, 1) = "[" THEN
link = 1
ELSEIF MID$(words$, a, 1) = "]" THEN
link = 0
out$ = out$ + makelink$(link$)
link$ = ""
ELSEIF link = 1 THEN
link$ = link$ + MID$(words$, a, 1)
ELSE
out$ = out$ + MID$(words$, a, 1)
END IF
NEXT
everything2html$ = out$
END FUNCTION
FUNCTION makelink$ (words$)
link$ = ""
out$ = ""
FOR a = 1 TO LEN(words$)
IF MID$(words$, a, 1) = "|" THEN
out$ = "<A HREF=" + CHR$(34) + "http://everything2.com/index.pl?node=" + link$ + CHR$(34) + " >"
out$ = out$ + RIGHT$(words$, LEN(words$) - a) + "</A>"
EXIT FOR
ELSE
link$ = link$ + MID$(words$, a, 1)
END IF
NEXT
IF out$ = "" THEN
out$ = "<A HREF=" + CHR$(34) + "http://everything2.com/index.pl?node=" + link$ + CHR$(34) + " >"
out$ = out$ + link$ + "</A>"
END IF
makelink$ = out$
END FUNCTION