Index

resty-gitweb / c69d6c0

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
315 Dec 2020 18:527890389Update copyright noticesJosh Stockin132G

Blob @ resty-gitweb / utils / nav.lua

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