;; Copyright (C) 2022 Ivan Polyakov ;; ;; This file is part of vilor's website. ;; ;; Vilor's website is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; Vilor's website is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . (import scss) (import (chicken string)) (define (path-with-build-time path suffix) (string-translate* path `((,suffix . ,(string-intersperse `("." ,(number->string build-time) ,suffix) ""))))) (define (clean-tpl page-title page-content #!optional (page-embedded-style '()) (page-styles '()) (page-scripts '()) (page-meta '())) `(html (@ (xmlns "http://www.w3.org/1999/xhtml") (xml:lang "en") (lang "en")) (head (meta (@ (http-equiv "Content-Type") (content "text/html; charset=ascii"))) (meta (@ (name "author") (content "Ivan Polyakov (vilor)"))) (meta (@ (name "viewport") (content "width=device-width, initial-scale=1"))) (meta (@ (name "robots") (content "noindex,nofollow"))) ,(map (lambda (args) `(meta ,(append '(@) args))) page-meta) ,(map (lambda (l) `(link (@ (rel "stylesheet") (href ,(path-with-build-time l ".css"))))) page-styles) (title ,page-title) ,(if (not (null? page-embedded-style)) `(style ,(scss->css page-embedded-style)) '())) (body ,page-content ,(map (lambda (l) `(script (@ (src ,(path-with-build-time l ".js")) (type "text/javascript")) " ")) page-scripts))))