htmllib, formatter
Terry Hancock
hancock at anansispaceworks.com
Tue Aug 6 17:11:54 EDT 2002
From: Milos Prudek <milos.prudek at tiscali.cz>
> I'd like to make an almost verbatim copy of a html file. The only change
> would be in a SRC tag of <IMG SRC>. Is htmllib suitable for this?
>
> In formatter.py, there's DumbWriter, which removes all HTML markup, but
> there is no "VerbatimWriter" which would keep all HTML as it is.
>
> My html file may contain a lot of advanced HTML 4.0 markup. Since
> htmllib supports only HTML 2.0, how difficult it would be to create
> "VerbatimWriter"? I feel I would have to create "start_table",
> "start_tr", "start_td", "start_script", and a lot of other procedures.
>
> This looks like an overkill if the aim is a simple modification of IMG
> SRC. Correct?
In your shoes, I would forget about the fact that it's
HTML, and just use the re module to do a regular
expression substitution. Probably much simpler, I visualize
3-5 lines of code for that.
Cheers,
Terry
--
------------------------------------------------------
Terry Hancock
hancock at anansispaceworks.com
Anansi Spaceworks
http://www.anansispaceworks.com
P.O. Box 60583
Pasadena, CA 91116-6583
------------------------------------------------------
More information about the Python-list
mailing list