Adds files.html and repo structure

This commit is contained in:
Miguel de la Cruz 2024-06-30 00:25:22 +02:00
parent 28f94c1499
commit 809ab91837
5 changed files with 289 additions and 42 deletions

53
templates/file.html.tmpl Normal file
View file

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{.filename}} - {{.repoInfo.Name}} - {{.repoInfo.Description}}</title>
<link rel="icon" type="image/png" href="../favicon.png" />
<link rel="alternate" type="application/atom+xml" title="bag Atom Feed" href="../atom.xml" />
<link rel="alternate" type="application/atom+xml" title="bag Atom Feed (tags)" href="../tags.xml" />
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
<body>
<table>
<tr>
<td><a href="../../"><img src="../logo.png" alt="" width="32" height="32" /></a></td>
<td><h1>{{.repoInfo.Name}}</h1><span class="desc">{{.repoInfo.Description}}</span></td>
</tr>
<tr class="url">
<td></td>
<td>
{{if ne .repoInfo.Url ""}}
git clone <a href="{{.repoInfo.Url}}">{{.repoInfo.Url}}</a>
{{end}}
</td>
</tr>
<tr>
<td></td>
<td>
<a href="../log.html">Log</a>
| <a href="../files.html">Files</a>
| <a href="../refs.html">Refs</a>
{{if .repoInfo.HasReadme}}
| <a href="../file/README.html">README</a>
{{end}}
{{if .repoInfo.HasLicense}}
| <a href="../file/LICENSE.html">LICENSE</a></td>
{{end}}
{{if .repoInfo.HasContributing}}
| <a href="../file/CONTRIBUTING.html">CONTRIBUTING</a></td>
{{end}}
</tr>
</table>
<hr/>
<div id="content">
<p> {{.filename}} ({{.filesize}}B)</p><hr/><pre id="blob">
{{- range $i, $line := .filelines}}
{{- $index := inc $i}}
<a href="#l{{$index}}" class="line" id="l{{$index}}">{{printf "%7d" $index}}</a> {{$line}}
{{- end}}
</pre>
</div>
</body>
</html>

55
templates/files.html.tmpl Normal file
View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Files - {{.repoInfo.Name}} - {{.repoInfo.Description}}
</title>
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="alternate" type="application/atom+xml" title="stagit Atom Feed" href="atom.xml" />
<link rel="alternate" type="application/atom+xml" title="stagit Atom Feed (tags)" href="tags.xml" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table>
<tr>
<td><a href="../"><img src="logo.png" alt="" width="32" height="32" /></a></td>
<td><h1>stagit</h1><span class="desc">static git page generator</span></td>
</tr>
<tr class="url">
<td></td>
<td>git clone <a href="git://git.codemadness.org/stagit">git://git.codemadness.org/stagit</a></td>
</tr>
<tr>
<td></td>
<td>
<a href="log.html">Log</a>
| <a href="files.html">Files</a>
| <a href="refs.html">Refs</a>
| <a href="file/README.html">README</a>
| <a href="file/LICENSE.html">LICENSE</a>
</td>
</tr>
</table>
<hr/>
<div id="content">
<table id="files"><thead>
<tr>
<td><b>Mode</b></td>
<td><b>Name</b></td>
<td class="num" align="right"><b>Size</b></td>
</tr>
</thead>
<tbody>
{{range .files}}
<tr>
<td>{{.Mode}}</td>
<td><a href="{{.Path}}">{{.Name}}</a></td>
<td class="num" align="right">{{.Lines}}L</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</body>
</html>