* [gentoo-user] less file.html
@ 2012-05-12 21:27 Stroller
2012-05-12 21:48 ` [gentoo-user] " Remy Blank
2012-05-12 21:49 ` Alex Schuster
0 siblings, 2 replies; 12+ messages in thread
From: Stroller @ 2012-05-12 21:27 UTC (permalink / raw
To: Gentoo-User
I want to view the html source of a webpage.
When I run `less file.html` the rendered webpage is shown, not the source. It is as if lynx had been invoked, rather than less.
`more file.html` and `most file.html` both work fine, but this is annoying - it takes an effort to prevent my fingers from typing `less`.
How do I disable less from parsing html source, please?
The matter appears to be addressed in neither the manpage nor the info file. Google doesn't seem to have any results, probably because "less" is such a common word used in other contexts.
Stroller.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [gentoo-user] Re: less file.html
2012-05-12 21:27 [gentoo-user] less file.html Stroller
@ 2012-05-12 21:48 ` Remy Blank
2012-05-12 21:50 ` Canek Peláez Valdés
2012-05-12 21:49 ` Alex Schuster
1 sibling, 1 reply; 12+ messages in thread
From: Remy Blank @ 2012-05-12 21:48 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
Stroller wrote:
> When I run `less file.html` the rendered webpage is shown, not the source. It is as if lynx had been invoked, rather than less.
As a workaround, you can use:
less <file.html
-- Remy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 21:27 [gentoo-user] less file.html Stroller
2012-05-12 21:48 ` [gentoo-user] " Remy Blank
@ 2012-05-12 21:49 ` Alex Schuster
2012-05-12 22:39 ` Stroller
2012-05-12 22:55 ` Stroller
1 sibling, 2 replies; 12+ messages in thread
From: Alex Schuster @ 2012-05-12 21:49 UTC (permalink / raw
To: gentoo-user
Stroller writes:
> I want to view the html source of a webpage.
>
> When I run `less file.html` the rendered webpage is shown, not the
> source. It is as if lynx had been invoked, rather than less.
>
> `more file.html` and `most file.html` both work fine, but this is
> annoying - it takes an effort to prevent my fingers from typing `less`.
>
> How do I disable less from parsing html source, please?
You can set LESSIGNORE='*.htm*'. This environment variable is used by the
lesspipe command, which is invoked by less and filters the input file
before giving it to less itself.
The is, if LESSOPEN='|lesspipe %s', which is set for me as such
in /etc/env.d/70less.
Wonko
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] Re: less file.html
2012-05-12 21:48 ` [gentoo-user] " Remy Blank
@ 2012-05-12 21:50 ` Canek Peláez Valdés
2012-05-12 22:41 ` [gentoo-user] " Stroller
0 siblings, 1 reply; 12+ messages in thread
From: Canek Peláez Valdés @ 2012-05-12 21:50 UTC (permalink / raw
To: gentoo-user
On Sat, May 12, 2012 at 4:48 PM, Remy Blank <remy.blank@pobox.com> wrote:
> Stroller wrote:
>> When I run `less file.html` the rendered webpage is shown, not the source. It is as if lynx had been invoked, rather than less.
>
> As a workaround, you can use:
>
> less <file.html
Another one; unset LESSOPEN:
LESSOPEN="" file.html
Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 21:49 ` Alex Schuster
@ 2012-05-12 22:39 ` Stroller
2012-05-12 22:40 ` Stroller
2012-05-12 22:55 ` Stroller
1 sibling, 1 reply; 12+ messages in thread
From: Stroller @ 2012-05-12 22:39 UTC (permalink / raw
To: gentoo-user
On 12 May 2012, at 22:49, Alex Schuster wrote:
> ...
>> I want to view the html source of a webpage.
>>
>> When I run `less file.html` the rendered webpage is shown, not the
>> source. It is as if lynx had been invoked, rather than less.
>> ...
>> How do I disable less from parsing html source, please?
>
> You can set LESSIGNORE='*.htm*'. This environment variable is used by the
> lesspipe command, which is invoked by less and filters the input file
> before giving it to less itself.
That's great! Thanks!
Searching the manpage for "lessopen" I find that I can use this shortcut instead:
less -L file.html
Stroller.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 22:39 ` Stroller
@ 2012-05-12 22:40 ` Stroller
0 siblings, 0 replies; 12+ messages in thread
From: Stroller @ 2012-05-12 22:40 UTC (permalink / raw
To: gentoo-user
On 12 May 2012, at 23:39, Stroller wrote:
>
> On 12 May 2012, at 22:49, Alex Schuster wrote:
>> ...
>>> I want to view the html source of a webpage.
>>>
>>> When I run `less file.html` the rendered webpage is shown, not the
>>> source. It is as if lynx had been invoked, rather than less.
>>> ...
>>> How do I disable less from parsing html source, please?
>>
>> You can set LESSIGNORE='*.htm*'. This environment variable is used by the
>> lesspipe command, which is invoked by less and filters the input file
>> before giving it to less itself.
>
> That's great! Thanks!
>
> Searching the manpage for "lessopen" I find that I can use this shortcut instead:
>
> less -L file.html
>
> Stroller.
Oooops! Damnit!
I replied to the wrong message. Please ignore the above.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 21:50 ` Canek Peláez Valdés
@ 2012-05-12 22:41 ` Stroller
0 siblings, 0 replies; 12+ messages in thread
From: Stroller @ 2012-05-12 22:41 UTC (permalink / raw
To: gentoo-user
On 12 May 2012, at 22:50, Canek Peláez Valdés wrote:
> ...
> Another one; unset LESSOPEN:
>
> LESSOPEN="" file.html
That's great! Thanks!
Searching the manpage for "lessopen" I find that I can use this shortcut instead:
less -L file.html
Stroller.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 21:49 ` Alex Schuster
2012-05-12 22:39 ` Stroller
@ 2012-05-12 22:55 ` Stroller
2012-05-12 23:22 ` Alex Schuster
1 sibling, 1 reply; 12+ messages in thread
From: Stroller @ 2012-05-12 22:55 UTC (permalink / raw
To: gentoo-user
On 12 May 2012, at 22:49, Alex Schuster wrote:
> …
>> I want to view the html source of a webpage.
>>
>> When I run `less file.html` the rendered webpage is shown, not the
>> source. It is as if lynx had been invoked, rather than less.
>> ...
>> How do I disable less from parsing html source, please?
>
> You can set LESSIGNORE='*.htm*'. This environment variable is used by the
> lesspipe command, which is invoked by less and filters the input file
> before giving it to less itself.
Contrary to my previous email, sent in error, that does NOT work.
Did you check this yourself?
$ LESSOPEN="" less file.html # works fine
$ LESSIGNORE='*.htm*' less file.html #does not
I've also tried `export LESSIGNORE='*.htm*'` (for what difference that makes?) and tried running the `less` command on a separate line.
What version of less are you using, please? I have =sys-apps/less-444 installed here.
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.
Stroller.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 22:55 ` Stroller
@ 2012-05-12 23:22 ` Alex Schuster
2012-05-13 4:12 ` Stroller
0 siblings, 1 reply; 12+ messages in thread
From: Alex Schuster @ 2012-05-12 23:22 UTC (permalink / raw
To: gentoo-user
Stroller writes:
> On 12 May 2012, at 22:49, Alex Schuster wrote:
[...]
> >> How do I disable less from parsing html source, please?
> >
> > You can set LESSIGNORE='*.htm*'. This environment variable is used by
> > the lesspipe command, which is invoked by less and filters the input
> > file before giving it to less itself.
>
> Contrary to my previous email, sent in error, that does NOT work.
>
> Did you check this yourself?
Yes. I did not know about this mechanism before, but 'env|grep -i less'
showed the LESS and LESSOPEN environment variable, so I learnt about the
lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
there.
> $ LESSOPEN="" less file.html # works fine
It should, for any type of file.
> $ LESSIGNORE='*.htm*' less file.html #does not
Working fine here.
> I've also tried `export LESSIGNORE='*.htm*'` (for what difference that
> makes?) and tried running the `less` command on a separate line.
There is no difference, but it's more convenient to export the variable as
you do not have to set it every time then.
> What version of less are you using, please? I have =sys-apps/less-444
> installed here.
445-r1, but I just downgraded to 444, and it behaves the same. I have the
pcre and unicode USE flags set, but don't assume they make any
difference. Weird, no idea why it it not working for you.
Wonko
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-12 23:22 ` Alex Schuster
@ 2012-05-13 4:12 ` Stroller
2012-05-13 5:57 ` Paul Colquhoun
0 siblings, 1 reply; 12+ messages in thread
From: Stroller @ 2012-05-13 4:12 UTC (permalink / raw
To: gentoo-user
On 13 May 2012, at 00:22, Alex Schuster wrote:
> …
>>> You can set LESSIGNORE='*.htm*'. This environment variable is used by
>>> the lesspipe command, which is invoked by less and filters the input
>>> file before giving it to less itself.
>>
>> Contrary to my previous email, sent in error, that does NOT work.
>>
>> Did you check this yourself?
>
> Yes. I did not know about this mechanism before, but 'env|grep -i less'
> showed the LESS and LESSOPEN environment variable, so I learnt about the
> lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
> there.
I have here now:
$ env | grep -i less
PAGER=/usr/bin/less
LESS=-R -M --shift 5
LESSOPEN=|lesspipe %s
LESSIGNORE=*.htm*
$
And still the same thing.
>> What version of less are you using, please? I have =sys-apps/less-444
>> installed here.
>
> 445-r1, but I just downgraded to 444, and it behaves the same. I have the
> pcre and unicode USE flags set, but don't assume they make any
> difference. Weird, no idea why it it not working for you.
Thanks for your help.
`less -L file.html` works for me - I've got a way of dealing with this, and I'm busy with other stuff right now, so I'm just going to forget worrying about LESSIGNORE.
I post the above output showing my less environment only for the benefit of anyone else encountering this in the future - perhaps it gives them something to go on.
I appreciate your assistance,
Stroller.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-13 4:12 ` Stroller
@ 2012-05-13 5:57 ` Paul Colquhoun
2012-05-13 7:15 ` Stroller
0 siblings, 1 reply; 12+ messages in thread
From: Paul Colquhoun @ 2012-05-13 5:57 UTC (permalink / raw
To: gentoo-user
On Sun, 13 May 2012 05:12:59 Stroller wrote:
> On 13 May 2012, at 00:22, Alex Schuster wrote:
> > …
> >
> >>> You can set LESSIGNORE='*.htm*'. This environment variable is used by
> >>> the lesspipe command, which is invoked by less and filters the input
> >>> file before giving it to less itself.
> >>
> >> Contrary to my previous email, sent in error, that does NOT work.
> >>
> >> Did you check this yourself?
> >
> > Yes. I did not know about this mechanism before, but 'env|grep -i less'
> > showed the LESS and LESSOPEN environment variable, so I learnt about the
> > lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
> > there.
>
> I have here now:
>
> $ env | grep -i less
> PAGER=/usr/bin/less
> LESS=-R -M --shift 5
> LESSOPEN=|lesspipe %s
> LESSIGNORE=*.htm*
> $
On my system, I get this as the lesspipe help message:
#########################################
[paulcol@bluering ~]
[Sun May 13 10:26:09]$ lesspipe --help
lesspipe: preproccess files before sending them to less
Usage: lesspipe <file>
lesspipe specific settings:
LESSCOLOR env - toggle colorizing of output (no/yes/always)
LESSCOLORIZER env - program used to colorize output (default:
code2color)
LESSIGNORE - list of extensions to ignore (don't do anything
fancy)
You can create per-user filters as well by creating the executable file:
~/.lessfilter
One argument is passed to it: the file to display.
To use lesspipe, simply add to your environment:
export LESSOPEN="|lesspipe %s"
Run 'less --help' or 'man less' for more info
#########################################
I would interpret the "don't do anything fancy" caveat on LESSIGNORE to mean
that wildcards may not work. Some experimenting on my system shows me that
this version seems to do what you want:
LESSIGNORE="htm html"
I don't normally have LESSOPEN set, so I havn't seen this situation before.
--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Before you criticize someone, you should walk a mile in their shoes.
Then, when you do, you'll be a mile away, and you'll have their shoes.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] less file.html
2012-05-13 5:57 ` Paul Colquhoun
@ 2012-05-13 7:15 ` Stroller
0 siblings, 0 replies; 12+ messages in thread
From: Stroller @ 2012-05-13 7:15 UTC (permalink / raw
To: gentoo-user
On 13 May 2012, at 06:57, Paul Colquhoun wrote:
> …
>>>>> You can set LESSIGNORE='*.htm*'. This environment variable is used by
>>>>> the lesspipe command, which is invoked by less and filters the input
>>>>> file before giving it to less itself.
>>>>
>> …
>> I have here now:
>>
>> $ env | grep -i less
>> PAGER=/usr/bin/less
>> LESS=-R -M --shift 5
>> LESSOPEN=|lesspipe %s
>> LESSIGNORE=*.htm*
>> $
>
> …
>
> I would interpret the "don't do anything fancy" caveat on LESSIGNORE to mean
> that wildcards may not work. Some experimenting on my system shows me that
> this version seems to do what you want:
>
> LESSIGNORE="htm html"
>
> I don't normally have LESSOPEN set, so I havn't seen this situation before.
Blimey! Thank you! That's wonderful!
:D
Stroller.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-05-13 7:17 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-12 21:27 [gentoo-user] less file.html Stroller
2012-05-12 21:48 ` [gentoo-user] " Remy Blank
2012-05-12 21:50 ` Canek Peláez Valdés
2012-05-12 22:41 ` [gentoo-user] " Stroller
2012-05-12 21:49 ` Alex Schuster
2012-05-12 22:39 ` Stroller
2012-05-12 22:40 ` Stroller
2012-05-12 22:55 ` Stroller
2012-05-12 23:22 ` Alex Schuster
2012-05-13 4:12 ` Stroller
2012-05-13 5:57 ` Paul Colquhoun
2012-05-13 7:15 ` Stroller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox