[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clean html text?
In an earlier article (which I haven't seen yet), Adalbert Goertz
<be404@yfn.ysu.edu> wrote:
> When I download Text.html files I get all kind of control junk with it.
> Is there a program which would remove these html.characters to make the
> text morre readable?
> What I have been doing to date is use the <remove and replace> command in
> AppleWorks to clean this up -which is time consuming.
And in the article to which I'm replying:
> I can use Lynx only thru the freenets.
What exactly do you mean by "control junk". I can think of two possible
interpretations:
1. Line termination characters.
HTML documents are simple text files, but web browsers don't care about
the characters used at the end of each line. This means that they tend
to be rather random (generally whatever is easiest for the web page
author to use). You might find pages that use CR-only at the end of
each line (e.g. authored on an Apple II or Macintosh), LF-only at the
end of each line (authored on UNIX) or CR/LF at the end of each line
(authored on a PC).
If you view the file in AppleWorks, any line feeds will be displayed as
a "#" symbol (hash, or the American pound sign). If the file only uses
line feeds, then there will be no identifiable line formatting, just #
symbols scattered through the file.
In any case, HTML doesn't need any line formatting (except in a
preformatted section), as the formatting is done explicitly with tokens
such as <p> (paragraph) and <br> (line break). Spaces, tabs, CR and LF
characters are ignored, except as word separators. The web browser is
responsible for displaying the HTML document in a readable form,
according to the tokens.
2. HTML command tokens.
If you view an HTML source document, you will see lots of special tokens
in angle brackets, such as <h1>, </h1>, <a href ...>, </a>, etc. These
are instructions to the web browser on how to format or display the
text, links to other information, etc.
If you don't want to see any of these in the saved HTML document, then
you should save when displaying it normally, not when viewing the HTML
source. (I haven't used Lynx for a while, and don't recall exactly how
saving pages works.)
--
David Empson
dempson@actrix.gen.nz
Snail Mail: P.O. Box 27-103, Wellington, New Zealand