what if we sexp'd the css too

is this good

(also, sorted the imports for no important reason)
This commit is contained in:
pho4cexa 2022-12-12 21:34:09 -08:00 committed by m455
parent f315cd9237
commit 8fb927143f

100
main.scm
View file

@ -1,22 +1,24 @@
#!/usr/bin/csi -s
(import utf8
lowdown
(chicken string)
(chicken port)
(chicken io)
(chicken process)
(chicken process-context)
(chicken format)
(chicken pathname)
(chicken file)
sxml-transforms
(clojurian syntax)
srfi-1 ;; list utils
srfi-13 ;; string utils
srfi-14 ;; charsets
symbol-utils ;; (unspecified-value)
)
(import
(chicken file)
(chicken format)
(chicken io)
(chicken pathname)
(chicken port)
(chicken process)
(chicken process-context)
(chicken string)
(clojurian syntax)
scss
lowdown
srfi-1 ;; list utils
srfi-13 ;; string utils
srfi-14 ;; charsets
sxml-transforms
symbol-utils ;; (unspecified-value)
utf8
)
(define CLONE-URL (or (get-environment-variable "REPO2HTML_CLONE_URL") "git://git.example.com"))
(define TITLE (or (get-environment-variable "REPO2HTML_TITLE") "my git repositories"))
@ -68,37 +70,37 @@
;; main code ---------------------------------
(define css "
body {
margin: 0 auto;
max-width: 700px;
}
pre, code {
background-color: #ffd9df;
}
pre {
padding: 15px 20px;
white-space: pre;
overflow: scroll;
}
a { color: blue; }
nav a { margin-right: 10px; }
hr {
border:0;
border-bottom: 1px solid black;
margin-top: 16px;
}
td {
padding: 0em .5em;
vertical-align: top;
}
footer {
text-align: right;
font-size: small;
}
#file-path {
/* change this to your liking */
}")
(define mycss
(with-output-to-string
(lambda ()
(write-css
'(css
(body
(margin 0 auto)
(max-width 700px))
(((pre) (code))
(background-color "#ffd9df"))
(pre
(overflow scroll)
(padding 15px 20px)
(white-space pre))
(a
(color blue))
((nav a)
(margin-right 10px))
(hr
(border 0)
(border-bottom 1px solid black)
(margin-top 16px))
(td
(padding 0em .5em)
(vertical-align top))
(footer
(font-size small)
(text-align right))
((= id file-path)
;; change this to your liking
))))))
(define (make-sxml-template-wrapper repository-name source-files-list)
(let ((readme-file
@ -119,7 +121,7 @@
(meta (@ (name viewport) (content "width=device-width, initial-scale-1.0, user-scalable=yes")))
(link (@ (rel icon) (href "data:,")))
(meta (@ (name description) (content ,DESCRIPTION)))
(style ,css))
(style ,mycss))
(body
(h1 ,H1)
(h2 ,repository-name)