summaryrefslogtreecommitdiff
path: root/newtablink.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-08-08 21:39:17 +0200
committerBotond Hende <nettingman@gmail.com>2024-08-08 21:39:17 +0200
commited0aa1323a7acae363c670cc1dd6611c09e0c3fb (patch)
tree6ba7dc3c303e791ad52c02986ac27a5a2cdde798 /newtablink.py
parentc307de76f9b54d5c65196341ee12ea38ac3d6e6b (diff)
extended image handles foreign images
Diffstat (limited to 'newtablink.py')
-rw-r--r--newtablink.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/newtablink.py b/newtablink.py
index df42833..621424d 100644
--- a/newtablink.py
+++ b/newtablink.py
@@ -7,6 +7,7 @@ MyExtension = get_new_tab_links(["example.org"])
"""
import marko.inline
from marko.helpers import MarkoExtension
+from . import utils
def __create_new_tab_links(filters: list[str]):
@@ -14,9 +15,7 @@ def __create_new_tab_links(filters: list[str]):
FILTERS = filters
def render_link(self, element: marko.inline.Link) -> str:
- dest_lower = element.dest.lower()
-
- if (dest_lower.startswith("http://") or dest_lower.startswith("https://")) and not any((elem in dest_lower for elem in NewTabLinks.FILTERS)):
+ if utils.is_foreign_url(element.dest, NewTabLinks.FILTERS):
return f"<a href=\"{element.dest}\" target=\"_blank\">{self.render_children(element)}</a>"
return super().render_link(element)