Let me be more clear: Long ago a friend kept suggesting
that I write a converter from TeX (maybe also LaTeX)
to HTML. I kept telling him that that was essentially
impossible because TeX is a programming language,
likely Turing machine equivalent, complete with
if-then-else, allocate-free, file read-write, while
HTML is just a text markup language. No doubt
JavaScript is Turning machine equivalent, but I'd have
a tough time believing that HTML is.
So, my suggestion here was not to convert TeX input
to HTML.
Instead my suggestion was just to convert TeX output,
that is, a DVI file, to HTML. Why? Because a DVI file
is essentially just text, or, as I outlined, it
specifies put this character at these coordinates on the
page, put that character there on the page,
go to a new page, etc.
To be more clear, say, about the file reading-writing,
that happens when the TeX program reads the user's
TeX input and before the DVI file is generated.
Given only the DVI file and displaying it,
there is no file reading-writing.
So, it looks like could convert TeX DVI output to HTML.
You pointed out that maybe HTML with a browser has
more flexibility than TeX output. Okay, maybe. But
I didn't claim that, given an HTML file, there would
be a TeX input file and a corresponding TeX DVI output
file that my envisioned converter would convert to
the given HTML file. Instead, I just claimed that
for a given TeX and DVI file, the converter would
generate an HTML file.
Or the converter would
be a function from the set
of all TeX DVI files to the set of all HTML files.
That is, for each TeX DVI file there would be
a corresponding HTML file from the converter.
But the function would not be onto the
set of HTML files, that is, not all HTML
files would be a value of the converter;
not all HTML files could be obtained
by using TeX input, the TeX program,
the DVI file and the envisioned converter.
You also mentioned some ways in which
HTML, say, with , is more flexible
than TeX. Fine. But I was discussing
just converting TeX DVI to HTML.
And, again, I see no way to convert TeX
input, which is a programming language,
to HTML, which is not a programming language.
Whew!
More clear now?