ansicat working again alone

This commit is contained in:
Lionel Dricot 2023-09-03 23:20:54 +02:00
parent 1a2cff83af
commit e14009f2a4
3 changed files with 20 additions and 14 deletions

View File

@ -1,28 +1,31 @@
# Offpunk History
## 2.0 - unreleased
TODO: better handling of folders with opnk
## 2.0-beta1 - unreleased
This is an an experimental release. Bug reports and feedbacks are welcome on the offpunk-devel list.
WARNING: pyproject.toml has not been update and is currently non-functional. Help wanted!
- IMPORTANT: Licence has been changed to AGPL for ideological reasons
- IMPORTANT: Contact adress has been changed to offpunk2 on the same domain (because of spam)
- IMPORTANT: code has been splitted into 7 differents files. Installation/packaging should be adapted.
Major features:
- New command-line tool: "netcache"
- New command-line tool: "ansicat"
- New command-line tool: "opnk"
- URL do not default anymore to "gemini://" if not protocol are indicated.
- Images of html files are now downloaded with the html (slower sync but better reading experience)
- Reading position is saved for the whole session
- Rendering is cached, allowing faster browsing
- Gopher-only: we dont support naming a page after the name of the incoming link
- "theme" command allows customization of the colours
- "--config-file" allows to start offpunk with custom config (#16)
- "accept_bad_ssl_certificates" now more agressive for http and really accepts them all
- Gemini-only: support for client generated certificates has been removed
Improvments:
- Reading position is saved for the whole session
- Rendering is cached for the session, allowing faster browsing of a page already visited
- "redirect" supports domains starting with "*" to also block all subdomins
- "file" is now marked as a dependency (thank Guillaume Loret)
- "--images-mode" allow to choose at startup which images should be dowloaded (none,readable,full)
- Support for multi-format rendering (such as RSS feeds with html elements)
- The cache is now automatically upgraded if needed (see .version in your cache)
- "theme" command allows customization of the colours
Other changes from 1.X:
- Images of html files are now downloaded with the html (slower sync but better reading experience)
- URL do not default anymore to "gemini://" if not protocol are indicated.
- "accept_bad_ssl_certificates" now more agressive for http and really accepts them all
- Gopher-only: we dont support naming a page after the name of the incoming link
- Gemini-only: support for client generated certificates has been removed
- "file" is now marked as a dependency (thank Guillaume Loret)
## 1.10 - July 31st 2023
- IMPORTANT : new optional dependency : python-chardet

View File

@ -431,6 +431,7 @@ class AbstractRenderer():
#small intelligence to try to find a good name for a capsule
#we try to find eithe ~username or /users/username
#else we fallback to hostname
if not self.url: return ""
if is_local(self.url):
splitpath = self.url.split("/")
filename = splitpath[-1]
@ -1246,8 +1247,9 @@ def set_renderer(content,url,mime,theme=None):
renderer.set_theme(theme)
return renderer
def render(input,path=None,format="auto",mime=None,url=None):
if not url: url = ""
else: url=url[0]
if format == "gemtext":
r = GemtextRenderer(input,url)
elif format == "html":
@ -1266,7 +1268,7 @@ def render(input,path=None,format="auto",mime=None,url=None):
else:
r = set_renderer(input,url,mime)
if r:
r.display()
r.display(directdisplay=True)
else:
print("Could not render %s"%input)

View File

@ -120,7 +120,8 @@ def term_width(new_width=None,absolute=False):
return width
def is_local(url):
if "://" in url:
if not url: return True
elif "://" in url:
scheme,path = url.split("://",maxsplit=1)
return scheme in ["file","mail","list","mailto"]
else: