Why is it with the version of less that comes with 7.2 now showing html files in there rendered form rather than source? the version in 7.0 showed html files in there coded form. Is there a way get it back to the old way? *--------------------------------* | Chris Large clarge@macn.bc.ca | | http://clarge.bc.ca | *--------------------------------*
On 06-Aug-01 Chris Large wrote:
Why is it with the version of less that comes with 7.2 now showing html files in there rendered form rather than source? the version in 7.0 showed html files in there coded form.
Is there a way get it back to the old way?
Yes there is (and I deprecate the new zizz-zazz which brings in
a lot of pseudo-functionality which is neither needed nor in some
cases works properly; see "Is 'less' broken in 7.2?" of 1 August).
Go (as root) to /usr/bin and edit lessopen.sh (but make a copy
first in case you really break it!).
Now you can remove what you don't want by putting a "#" at the
beginning of the relevant lines (but watch out for the script's
"case" logic -- that's easy to break).
In my case, I decided to keep everything corresponding to
cases "gzip...", "Zip...", "compress'd...", "packed...", "bzip"
(these do add something useful to 'less' without interfering
with its primary function), and also decided to let "tar...",
"RPM*" and " ar..." stay in, since these are not going to impinge on
what I use 'less' for anyway, and could possibly prove useful.
I cut out cases "troff*", "DVI", "PostScript*", "PDF*", and "HTML*",
since these prevented me from using 'less' for what I wanted
(I regularly use 'less' to scan up and down the content of
troff-source or macros, PostScript code, HTML code and sometimes
raw PDF; and the sort of DVI I have dealings with -- documents
with lots of maths etc. produced by TeX -- are not going to
make much sense if "viewed" with dvi2tty; and as for ps2ascii ...).
In the version of the file in my SuSE-7.2, this meant putting a "#"
at the start of lines:
37-58, 64-83 (both ranges inclusive).
Now you should have something which works as 'less' should, with
the benefit that compressed/zipped text files will be converted to
plain before going into 'less'.
In particular, you can view HTML code as HTML code (rather than
formatted by lynx -- if one wants to do that one can use lynx!),
PostScript code as PostScript code (rather than whatever ps2ascii
thinks is its text content which is almost always at least a bit
wrong and often dreadful), and whereas you can't make much sense of
DVI code or PDF code anyway unless you're really into them (which
I have been for PDF when studying PDFmarks) at least you can view
these native instead of mangled by dvi2tty or pdftotext if you need
to; who would want to view the real intended effect of PS or DVI or
PDF other than in the proper tool such as gv, dvips | gv, acroread?
Oh, and by the way the tool that decides what the file type is
(the 'file' program) is none too reliable either (have a look
at /etc/magic for the horrid details); yet the stuff in lessopen.sh
depends on it. At any rate for the ones I decided to keep, 'file'
should be pretty reliable.
Hope this helps!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding)
Thanks. I'll try it later on.
Why is it with the version of less that comes with 7.2 now showing html files in there rendered form rather than source? the version in 7.0 showed html files in there coded form.
Is there a way get it back to the old way?
Yes there is (and I deprecate the new zizz-zazz which brings in a lot of pseudo-functionality which is neither needed nor in some cases works properly; see "Is 'less' broken in 7.2?" of 1 August).
Go (as root) to /usr/bin and edit lessopen.sh (but make a copy first in case you really break it!).
Now you can remove what you don't want by putting a "#" at the beginning of the relevant lines (but watch out for the script's "case" logic -- that's easy to break).
In my case, I decided to keep everything corresponding to cases "gzip...", "Zip...", "compress'd...", "packed...", "bzip" (these do add something useful to 'less' without interfering with its primary function), and also decided to let "tar...", "RPM*" and " ar..." stay in, since these are not going to impinge on what I use 'less' for anyway, and could possibly prove useful.
I cut out cases "troff*", "DVI", "PostScript*", "PDF*", and "HTML*", since these prevented me from using 'less' for what I wanted (I regularly use 'less' to scan up and down the content of troff-source or macros, PostScript code, HTML code and sometimes raw PDF; and the sort of DVI I have dealings with -- documents with lots of maths etc. produced by TeX -- are not going to make much sense if "viewed" with dvi2tty; and as for ps2ascii ...).
In the version of the file in my SuSE-7.2, this meant putting a "#" at the start of lines:
37-58, 64-83 (both ranges inclusive).
Now you should have something which works as 'less' should, with the benefit that compressed/zipped text files will be converted to plain before going into 'less'.
In particular, you can view HTML code as HTML code (rather than formatted by lynx -- if one wants to do that one can use lynx!), PostScript code as PostScript code (rather than whatever ps2ascii thinks is its text content which is almost always at least a bit wrong and often dreadful), and whereas you can't make much sense of DVI code or PDF code anyway unless you're really into them (which I have been for PDF when studying PDFmarks) at least you can view these native instead of mangled by dvi2tty or pdftotext if you need to; who would want to view the real intended effect of PS or DVI or PDF other than in the proper tool such as gv, dvips | gv, acroread?
Oh, and by the way the tool that decides what the file type is (the 'file' program) is none too reliable either (have a look at /etc/magic for the horrid details); yet the stuff in lessopen.sh depends on it. At any rate for the ones I decided to keep, 'file' should be pretty reliable.
Hope this helps! Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding)
Fax-to-email: +44 (0)870 167 1972 Date: 06-Aug-01 Time: 17:38:10 ------------------------------ XFMail ------------------------------
*--------------------------------* | Chris Large clarge@macn.bc.ca | | http://clarge.bc.ca | *--------------------------------*
participants (2)
-
Chris Large
-
Ted.Harding@nessie.mcc.ac.uk