pinboard-elinks

Check-in [b2ece6336b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add fix for websites that don't text wrap properly As a result of [this email] [1] on the ELinks-users list I worked out that some websites use <pre> tags where I'd expect them to use a <p> or <div>, etc and Elinks, probably correctly, refuses to wrap <pre> elements. So rather than fix Elinks, use Lua to fix the offending webpages. [1]: http://lists.linuxfromscratch.org/pipermail/elinks-users/2015-August/002192.html
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: b2ece6336b57354d98845b73e889b5a48bdc582ff7cb360e4b668f5e2fb00730
User & Date: base@atomicules.co.uk 2015-08-07 20:22:35
Context
2015-08-07
20:32
Add comment about how last commit not related to Pinboard check-in: b8e00b07b3 user: base@atomicules.co.uk tags: master, trunk
20:22
Add fix for websites that don't text wrap properly As a result of [this email] [1] on the ELinks-users list I worked out that some websites use <pre> tags where I'd expect them to use a <p> or <div>, etc and Elinks, probably correctly, refuses to wrap <pre> elements. So rather than fix Elinks, use Lua to fix the offending webpages. [1]: http://lists.linuxfromscratch.org/pipermail/elinks-users/2015-August/002192.html check-in: b2ece6336b user: base@atomicules.co.uk tags: master, trunk
2015-07-20
20:03
Add tweets link as well as starred check-in: 6079ccfc6a user: base@atomicules.co.uk tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pinboard.lua.

50
51
52
53
54
55
56








57
58
59
60
61
62
63
		html = string.gsub (html, '(<div id="top_menu">\n<a href="/u:)(%w-)(/".-</a> ‧ )', '%1%2%3<a href="/u:%2/starred/" >starred</a>  ‧ <a href="/u:%2/tweets/" >tweets</a> ‧')
		return html
	elseif string.find(url, "://pinboard.in/add%?url=") then --need to escape the ? here
		--Remove delete and destroy from the add page.
		html = string.gsub (html, '<div style="display:inline" id="delete_.-</div>', '')
		html = string.gsub (html, '<div style="visibility:hidden;display:none" class="delete_div" id="destroy_.-</div>', '')
		return html








	end
end


function new_edit_link (s)
	local _,_,link = string.find (s, '<a class="bookmark_title.-href="(.-)"')
	local login,token = readnetrc()







>
>
>
>
>
>
>
>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
		html = string.gsub (html, '(<div id="top_menu">\n<a href="/u:)(%w-)(/".-</a> ‧ )', '%1%2%3<a href="/u:%2/starred/" >starred</a>  ‧ <a href="/u:%2/tweets/" >tweets</a> ‧')
		return html
	elseif string.find(url, "://pinboard.in/add%?url=") then --need to escape the ? here
		--Remove delete and destroy from the add page.
		html = string.gsub (html, '<div style="display:inline" id="delete_.-</div>', '')
		html = string.gsub (html, '<div style="visibility:hidden;display:none" class="delete_div" id="destroy_.-</div>', '')
		return html
	--Fix none, wrapping pages. For now, just this one
	elseif string.find(url, "antirez") then
		--Change <pre> to <div> this is very hacky and prone to failure
		html = string.gsub (html, '<pre(.-)</pre>', '<div%1</div>')
		--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


function new_edit_link (s)
	local _,_,link = string.find (s, '<a class="bookmark_title.-href="(.-)"')
	local login,token = readnetrc()