pinboard-elinks

Check-in [b8e00b07b3]
Login

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

Overview
Comment:Add comment about how last commit not related to Pinboard
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: b8e00b07b34ab27a62344b3e39b7451bb792ec342275e316be928ccd110264c7
User & Date: base@atomicules.co.uk 2015-08-07 20:32:28
Context
2015-08-07
22:08
Revert commits 7036095 and 4fd8445 Figured out you can append to Lua functions so I'll leave this for Pinboard only and append to it in my hooks.lua file. Leaf check-in: a2d3a5dc83 user: base@atomicules.co.uk tags: master, trunk
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pinboard.lua.

51
52
53
54
55
56
57

58
59
60
61
62
63
64
		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







>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
		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
	--This is nothing to do with Pinboard, but I can only have one pre_format_html_hook
	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