Hello again Lars,
On 05-Aug-2015 20:20:16, atomicules wrote:
One hacky fix (what I might try first) is to use Lua, etc to re-write
problematic pages and swap the <pre> tags for something else.
I'm glad you mentioned this issue as I've now figured out a fix for a
blog I read every so often, http://antirez.com, which I'll use as an
example. I.e. say this post: http://antirez.com/news/91
This is a hacky lua script, but seems to work "ok":
function pre_format_html_hook (url, html)
if string.find(url, "bugzilla") then
--Change <pre> to <div> this is very hacky
html = string.gsub (html, '<pre(.-)</pre>', '<div%1</div>')
--But since we only want to do this for pre not followed by
code, change any divs followed by code back to pre
html = string.gsub (html, '<div(.-<code.-</code>.-)</div>',
'<pre%1</pre>')
return html
end
end
Unfortunately, however, I tried it on your problem page
(https://bugzilla.redhat.com/show_bug.cgi?id=785772) and although the
replacements of the <pre> s works, it still doesn't fix the text
wrapping issue. I think the markup of this page is wrong though. If
you look at the source after each <pre class="bz_comment_text
bz_wrap_comment_text"> element there is a closing div and then an
opening div. Looks odd: </div><div id="c2" class="bz_comment">
So you'd have to do something specifically for that page to remove
those as well:
function pre_format_html_hook (url, html)
if string.find(url, "bugzilla") then
--Change <pre> to <div> this is very hacky
html = string.gsub (html, '<pre(.-)</pre>.-</div><div.->',
'<div%1</div>')
--But since we only want to do this for pre not followed by
code, change any divs followed by code back to pre
html = string.gsub (html, '<div(.-<code.-</code>.-)</div>',
'<pre%1</pre>')
return html
end
end
Unfortunately this still doesn't quite work. Some text wrapping
definitely occurs (and W toggles it), but it's wrapped at some point
off the screen. I'm stumped for now as how to improve things, but
perhaps this might give you some ideas though.
--
http://lists.linuxfromscratch.org/listinfo/elinks-users
Unsubscribe: See the above information page