|
@@ -105,6 +105,11 @@ def inline_image(img_file,width):
|
|
|
#Chafa is faster than timg inline. Let use that one by default
|
|
|
inline = None
|
|
|
ansi_img = ""
|
|
|
+ #We avoid errors by not trying to render non-image files
|
|
|
+ if shutil.which("file"):
|
|
|
+ mime = run("file -b --mime-type \"%s\""%img_file).strip()
|
|
|
+ if not "image" in mime:
|
|
|
+ return ansi_img
|
|
|
if _HAS_CHAFA:
|
|
|
if _HAS_PIL and not _NEW_CHAFA:
|
|
|
# this code is a hack to remove frames from animated gif
|
|
@@ -3637,13 +3642,18 @@ archives, which is a special historical list limited in size. It is similar to `
|
|
|
lines = lf.readlines()
|
|
|
lf.close()
|
|
|
to_write = []
|
|
|
+ # let’s remove the mode
|
|
|
+ url = url.split("##offpunk_mode=")[0]
|
|
|
for l in lines:
|
|
|
# we separate components of the line
|
|
|
# to ensure we identify a complete URL, not a part of it
|
|
|
splitted = l.split()
|
|
|
- if url not in splitted:
|
|
|
+ if url not in splitted and len(splitted) > 0:
|
|
|
+ current = splitted[1].split("##offpunk_mode=")[0]
|
|
|
#sometimes, we must remove the ending "/"
|
|
|
- if url.endswith("/") and url[:-1] in splitted:
|
|
|
+ if url == current:
|
|
|
+ to_return = True
|
|
|
+ elif url.endswith("/") and url[:-1] == current:
|
|
|
to_return = True
|
|
|
else:
|
|
|
to_write.append(l)
|