Index

resty-gitweb / adbeb10

A git web interface for Lua/OpenResty (you're on it right now!)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
113 Dec 2020 16:16e49d46eInitial commit (imported, read description)Josh Stockin1190G

Blob @ resty-gitweb / utils / nav.lua

text/plain522 bytesdownload raw
1-- nav.lua
2-- Builds HTML anchors for navigation
3
4-- Copyright (c) 2020 Joshua 'joshuas3' Stockin
5-- <https://joshstock.in>
6
7local _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))
17end
18
19return _M
20