New view link feature

"view 12" will now gives you hindsight about link 12
This commit is contained in:
Ploum 2023-12-06 15:11:18 +01:00
parent 92516082c1
commit f373144cca
2 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,7 @@
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)
- redirections is now reflected in links and the cache (bug #28)
- offpunk : new "copy title" and "copy link" function
- offpunk : new "view XX" feature where XX is a number to view information about a link
- ansicat: added "--mode" option
- ansicat: avoid a crash when urllib.parse.urljoin fails
- offpunk: Fix a crash when gus is called without parameters (Von Hohenheiden)

View File

@ -954,6 +954,7 @@ Use "view normal" to see the default article view on html page.
Use "view full" to see a complete html page instead of the article view.
Use "view feed" to see the the linked feed of the page (in any).
Use "view feeds" to see available feeds on this page.
Use "view XX" where XX is a number to view information about link XX.
(full, feed, feeds have no effect on non-html content)."""
if self.current_url and args and args[0] != "":
u, m = unmode_url(self.current_url)
@ -980,8 +981,21 @@ Use "view feeds" to see available feeds on this page.
ans = input(stri)
if ans.isdigit() and 0 < int(ans) <= len(subs):
self.do_go(subs[int(ans)-1][0])
elif args[0].isdigit():
link_url = self.get_renderer().get_link(int(args[0]))
if link_url:
print("Link %s is: %s"%(args[0],link_url))
if netcache.is_cache_valid(link_url):
last_modified = netcache.cache_last_modified(link_url)
link_renderer = self.get_renderer(link_url)
link_title = link_renderer.get_page_title()
print(link_title)
print("Last cached on %s"%time.ctime(last_modified))
else:
print("No cached version for this link")
else:
print("Valid argument for view are : normal, full, feed, feeds")
print("Valid argument for view are : normal, full, feed, feeds or a number")
else:
self._go_to_url(self.current_url)