View previous topic :: View next topic |
Author |
Message |
albright Advocate
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Sat Nov 10, 2012 1:13 am Post subject: stop `less` interpreting html [SOLVED] |
|
|
Sorry for this elementary question, but the answer does
not leap off the man page for me.
When I use less on an html file it produces something like
this when it encounters a numbered list:
Code: | 3. What is the difference between "knowledge skepticism" and "rational
belief" skepticism?
4.
5. Outline the problem that Hume sees with inductive arguments.
6.
7. Define 'high reliability' for a method of inference.
|
How can I stop this pointless, stupid and incompetent
behaviour and have less display a text file as a G**D***
text file? _________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Last edited by albright on Sun Nov 11, 2012 12:28 am; edited 1 time in total |
|
Back to top |
|
|
Hypnos Advocate
Joined: 18 Jul 2002 Posts: 2889 Location: Omnipresent
|
Posted: Sat Nov 10, 2012 1:35 am Post subject: |
|
|
I cannot reproduce the behavior you observe. Here's my HTML file:
Code: | <html>
<head><title>foo</title></head>
<body>
<ol>
<li> Moo
<li> Cow
<li> Bar
</ol>
</body>
</html> |
The display in less looks identical.
Are you sure your HTML file just doesn't have a numbered list written out explicitly? _________________ Personal overlay | Simple backup scheme |
|
Back to top |
|
|
srs5694 Guru
Joined: 08 Mar 2004 Posts: 434 Location: Woonsocket, RI
|
Posted: Sat Nov 10, 2012 2:14 am Post subject: |
|
|
Code: |
less -L infile.html
|
|
|
Back to top |
|
|
albright Advocate
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Sat Nov 10, 2012 1:25 pm Post subject: |
|
|
thanks for the reply; this is more interesting than it looks then
Here is how "my" less shows your html file:
Code: |
1. Moo
2. Cow
3. Bar
|
(mine had some <br>s in it which made the list so messed up
when less tried to interpret it)
`more` displays text files as text files I've discovered
my less is version 451 (sys-apps/less) _________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme) |
|
Back to top |
|
|
albright Advocate
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Sat Nov 10, 2012 1:32 pm Post subject: |
|
|
I found the reason:
the variable $LESSOPEN=|lesspipe %s
once I clear that, less behaves properly
but I'm stumped at what is setting $LESSOPEN (I
may have done it myself in some distant past
I must admit )
EDIT: /etc/profile.env sets $LESSOPEN
EDIT2: editing /env.d/70less fixes it _________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme) |
|
Back to top |
|
|
Hypnos Advocate
Joined: 18 Jul 2002 Posts: 2889 Location: Omnipresent
|
Posted: Sat Nov 10, 2012 2:37 pm Post subject: |
|
|
I'm using less version 436. But, my /etc/env.d/70less has the same settings:
Code: | LESSOPEN="|lesspipe.sh %s"
LESS="-R -M --shift 5" |
However, my /usr/bin/lesspipe.sh has no rule for HTML files. _________________ Personal overlay | Simple backup scheme |
|
Back to top |
|
|
albright Advocate
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Sat Nov 10, 2012 4:46 pm Post subject: |
|
|
this is fairly interesting
there are two html2text programs:
dev-python/html2text
app-text/html2text
I had the latter installed and it messes up at least some html
files when it textifies them.
I switched to dev-python/html2text and it renders better IMO
(I had to edit lesspipe.sh's call to html2text slightly since as it
stands it sets a non-existent option for the python version)
But that's not the end.
On my x86 laptop, less also renders html text (and does a pretty
good job) BUT no text2html program is installed ... (wtf?)
EDIT: less is using lynx on the laptop which is not installed on
my desktop - everything is illuminated _________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme) |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sat Nov 10, 2012 11:25 pm Post subject: |
|
|
albright ...
the standard 'lesspipe' (at least the version supplied with gentoo) does not provide the means to disable the conversion, so the *.html is paged as parsed through the less filter (html2txt, w3m, elinks, etc). If you install Wolfgang Friebel's lesspipe any filtering can be disabled by appending a colon to the filename, eg: "less file.html:"
best ... khay |
|
Back to top |
|
|
|