1 | -- nav.lua |
2 | -- Builds HTML anchors for navigation |
3 |
|
4 | -- Copyright (c) 2020 Joshua 'joshuas3' Stockin |
5 | -- <https://joshstock.in> |
6 |
|
7 | local _M = function(nav_data, join) |
8 | join = join or " | " |
9 | local build = {} |
10 | for _, link in pairs(nav_data) do |
11 | local url = link[1] |
12 | local text = link[2] |
13 | local f = string.format([[<a class="link" href="%s">%s</a>]], url, text) |
14 | table.insert(build, f) |
15 | end |
16 | return string.format([[<span class="nav">%s</span>]], table.concat(build, join)) |
17 | end |
18 |
|
19 | return _M |
20 |
|