Gentoo Archives: gentoo-user

From: Stroller <stroller@××××××××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] less file.html
Date: Sat, 12 May 2012 22:56:45
Message-Id: 23D495F0-B671-4A20-B06F-AEC4F0BE4A5D@stellar.eclipse.co.uk
In Reply to: Re: [gentoo-user] less file.html by Alex Schuster
1 On 12 May 2012, at 22:49, Alex Schuster wrote:
2 > …
3 >> I want to view the html source of a webpage.
4 >>
5 >> When I run `less file.html` the rendered webpage is shown, not the
6 >> source. It is as if lynx had been invoked, rather than less.
7 >> ...
8 >> How do I disable less from parsing html source, please?
9 >
10 > You can set LESSIGNORE='*.htm*'. This environment variable is used by the
11 > lesspipe command, which is invoked by less and filters the input file
12 > before giving it to less itself.
13
14 Contrary to my previous email, sent in error, that does NOT work.
15
16 Did you check this yourself?
17
18 $ LESSOPEN="" less file.html # works fine
19 $ LESSIGNORE='*.htm*' less file.html #does not
20
21 I've also tried `export LESSIGNORE='*.htm*'` (for what difference that makes?) and tried running the `less` command on a separate line.
22
23 What version of less are you using, please? I have =sys-apps/less-444 installed here.
24
25 As per my previous reply to Canek's suggestion, I now have a working solution. LESSOPEN is the keyword that works for me, here. So I only make this reply to you now for completeness, as part of the eternal quest for deeper understanding and for the benefit of those searching in the future. LESSIGNORE seems even more poorly documented than LESSOPEN - I'm afraid I never think to use `info`, only `man` in the first instance.
26
27 Stroller.

Replies

Subject Author
Re: [gentoo-user] less file.html Alex Schuster <wonko@×××××××××.org>