summaryrefslogtreecommitdiffstats
path: root/plugins/external_links.lua
blob: 0edf9d8709c7f3e83f7ceb17c81ecd0fcef2310a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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