There are many programs named in the style <type>2html. I know of tex2html, doc2html sgml2html. As well as the "jw" program which can convert between various document types.
I didn't find a text2 html, but you could use a simple sed script to do it.
Code:
1i\
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\
<html>\
<head>\
\<meta content="text/html; charset=ISO-8859-1"\
http-equiv="content-type">\
\<title></title>
s/^\(.*$\)/\1<br>/
$a\
<\/head>\
<\/html>
Save this file as text2html.sed and call it like:
sed -f text2html.sed textfilename.txt > htmlfilename.html
You could use a bash for loop to convert all *.txt files in a directory:
Code:
for textfile in *.txt; do
sed -f text2html.sed ${textfile} > ${textfile%txt}html
done
Actually, I've never done any work in html. So I produced a simple html page of just text in Mozilla Composer, and based the script on the html page that I saved. There are only 3 sed commands! So the reason that you couldn't find a linux program to do it, it that is easy to do using normal tools.
------------------
I tried something else. I loaded in a text file in konqueror and exported it to html.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="Kate, the KDE Advanced Text Editor" />
<title>sample3.html</title>
</head>
<body>
<pre>
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2005.9.18) 11 NOV 2005 23:03
**grfguide.tex
(./grfguide.tex
! Undefined control sequence.
l.9 \begin
{filecontents*}{a.ps}
? R
OK, entering \nonstopmode...
[1] )
Output written on grfguide.dvi (1 page, 408 bytes).
</pre></body>
</html>
You could write a simple bash script that uses here documents to
A) Write the first 10 lines to the output, containing <title>${1}</title>, or something similar so that each page gets the title of the file you are converting.
B) Insert the contents of the text file.
C) Add the last 3 lines.
One thing to consider is having to check if the text contains any sequences of characters such as </head> that would have a meaning to the browser. You would need to escape them either manually or by adding a number of sed commands to do this automatically. If this would be a rare occurance, you could load that text file into konqueror and export it as html. Konqueror uses Kate to do the job, so you can just use "kate".
Another option would be to produce a KDE style script to use KATE to convert a number of text files to html. This option would allow you to even use a file requestor to select the files to convert. This does assume that you have KDE installed.