pho4cexa 2022-12-02 14:54:10 -08:00 committed by m455
parent 663be9e77c
commit 1165ba3342

View file

@ -52,24 +52,23 @@
(define DESCRIPTION (or (get-environment-variable "GIT_WWW_DESCRIPTION") "my git repositories"))
(define H1 (or (get-environment-variable "GIT_WWW_H1") "git.example.com"))
(define HTML-TEMPLATE
#<<string-block
(define (populate-html-template body)
#<#string-block
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{title}}</title>
<title>#{TITLE}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<link rel="icon" href="data:,">
<meta name="description" content="{{description}}"/>
<meta name="description" content="#{DESCRIPTION}"/>
<style>
body {
margin: 0 auto;
max-width: 700px;
}
pre {
background-color: #ffd9df;
background-color: ##ffd9df;
padding: 15px 20px;
white-space: pre;
overflow: scroll;
@ -81,21 +80,21 @@ hr {
border-bottom: 1px solid black;
margin-top: 16px;
}
#file-path {
##file-path {
/* change this to your liking */
}
</style>
</head>
<body>
<h1>{{h1}}</h1>
<h2>{{repository-name}}</h2>
<p>clone url: {{clone-url}}/{{repository-name}}</p>
<h1>#{H1}</h1>
<h2>#{*repository-name*}</h2>
<p>clone url: #{CLONE-URL}/#{*repository-name*}</p>
<nav>
<a href="/{{repository-name}}/index.html">about</a>
<a href="/{{repository-name}}/files.html">files</a>
<a href="/#{*repository-name*}/index.html">about</a>
<a href="/#{*repository-name*}/files.html">files</a>
</nav>
<hr>
{{body-contents}}
#{body}
</body>
</html>
string-block
@ -104,17 +103,6 @@ string-block
(define (write-file file contents)
(with-output-to-file file (lambda () (display contents))))
(define (populate-html-template body-contents)
(string-translate*
HTML-TEMPLATE
`(
("{{title}}" . ,TITLE)
("{{description}}" . ,DESCRIPTION)
("{{h1}}" . ,H1)
("{{clone-url}}" . ,CLONE-URL)
("{{repository-name}}" . ,*repository-name*)
("{{body-contents}}" . ,body-contents))))
(define (in-git-directory?)
(if (equal? (call-with-input-pipe "git rev-parse --is-bare-repository 2> /dev/null" read-line) "true")
#t