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 @@ @@ -18,16 +18,20 @@
(define (clean-tpl
page-title
page-content
#!optional (page-styles '()) (page-scripts '()))
#!optional (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")))
,(map (lambda (args)
`(meta ,(append '(@) args))) page-meta)
,(map (lambda (l)
`(link (@ (rel "stylesheet") (href ,l))))
page-styles)

32
src/templates/default.scm

@ -17,31 +17,17 @@ @@ -17,31 +17,17 @@
(load "./src/components/header.scm")
(load "./src/components/footer.scm")
(load "./src/templates/clean.scm")
(define (default-tpl
page-title
page-content
page-name
page-desc
#!optional (page-styles '()) (page-scripts '()))
`(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 "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"))
#!optional (page-styles '()) (page-scripts '()) (page-meta '()))
(clean-tpl
page-title
`(div (@ (class "wrapper"))
,header
(hr)
@ -51,5 +37,9 @@ @@ -51,5 +37,9 @@
,page-content)
(hr)
,footer
,(map (lambda (l) `(script (@ (src ,l)))) page-scripts)))))
,footer)
(append
'("/style.css")
page-styles)
page-scripts
page-meta))

Loading…
Cancel
Save