summaryrefslogtreecommitdiffstats
path: root/plugins/external_links.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/external_links.lua')
-rw-r--r--plugins/external_links.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/external_links.lua b/plugins/external_links.lua
new file mode 100644
index 0000000..0edf9d8
--- /dev/null
+++ b/plugins/external_links.lua
@@ -0,0 +1,16 @@
+links = HTML.select(page, "a")
+
+index, link = next(links)
+
+while index do
+ href = HTML.get_attribute(link, "href")
+
+ if href then
+ if Regex.match(href, "^https?://") then
+ icon = HTML.parse("<i class=\"fa fa-external-link\" aria-hidden=\"true\"></i>")
+ HTML.append_child(link, icon)
+ end
+ end
+
+ index, link = next(links, index)
+end