Browse Source

extending templates

pull/2/head
Ivan Polyakov 3 years ago
parent
commit
6d49760d28
  1. 6
      src/templates/clean.scm
  2. 32
      src/templates/default.scm

6
src/templates/clean.scm

@ -18,16 +18,20 @@
(define (clean-tpl (define (clean-tpl
page-title page-title
page-content page-content
#!optional (page-styles '()) (page-scripts '())) #!optional (page-styles '()) (page-scripts '()) (page-meta '()))
`(html (@ (xmlns "http://www.w3.org/1999/xhtml") `(html (@ (xmlns "http://www.w3.org/1999/xhtml")
(xml:lang "en") (xml:lang "en")
(lang "en")) (lang "en"))
(head (head
(meta (@ (http-equiv "Content-Type") (meta (@ (http-equiv "Content-Type")
(content "text/html; charset=ascii"))) (content "text/html; charset=ascii")))
(meta (@ (name "author") (content "Ivan Polyakov (vilor)")))
(meta (@ (name "viewport") (meta (@ (name "viewport")
(content "width=device-width, initial-scale=1"))) (content "width=device-width, initial-scale=1")))
,(map (lambda (args)
`(meta ,(append '(@) args))) page-meta)
,(map (lambda (l) ,(map (lambda (l)
`(link (@ (rel "stylesheet") (href ,l)))) `(link (@ (rel "stylesheet") (href ,l))))
page-styles) page-styles)

32
src/templates/default.scm

@ -17,31 +17,17 @@
(load "./src/components/header.scm") (load "./src/components/header.scm")
(load "./src/components/footer.scm") (load "./src/components/footer.scm")
(load "./src/templates/clean.scm")
(define (default-tpl (define (default-tpl
page-title page-title
page-content page-content
page-name page-name
page-desc page-desc
#!optional (page-styles '()) (page-scripts '())) #!optional (page-styles '()) (page-scripts '()) (page-meta '()))
`(html (@ (xmlns "http://www.w3.org/1999/xhtml") (clean-tpl
(xml:lang "en") page-title
(lang "en")) `(div (@ (class "wrapper"))
(head
(meta (@ (http-equiv "Content-Type")
(content "text/html; charset=ascii")))
(meta (@ (name "viewport")
(content "width=device-width, initial-scale=1")))
,(map (lambda (l)
`(link (@ (rel "stylesheet") (href ,l))))
page-styles)
(link (@ (rel "stylesheet") (href "/style.css")))
(title ,title))
(body
(div (@ (class "wrapper"))
,header ,header
(hr) (hr)
@ -51,5 +37,9 @@
,page-content) ,page-content)
(hr) (hr)
,footer ,footer)
,(map (lambda (l) `(script (@ (src ,l)))) page-scripts))))) (append
'("/style.css")
page-styles)
page-scripts
page-meta))

Loading…
Cancel
Save