Browse Source

extending templates

pull/2/head
Ivan Polyakov 2 years ago
parent
commit
6d49760d28
  1. 6
      src/templates/clean.scm
  2. 46
      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)

46
src/templates/default.scm

@ -17,39 +17,29 @@ @@ -17,39 +17,29 @@
(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")))
#!optional (page-styles '()) (page-scripts '()) (page-meta '()))
(clean-tpl
page-title
`(div (@ (class "wrapper"))
,header
(hr)
,(map (lambda (l)
`(link (@ (rel "stylesheet") (href ,l))))
page-styles)
(div (@ (class "content container"))
(h1 (@ (class "content__title")) ,page-name)
(div (@ (class "content__description")) ,page-desc)
,page-content)
(link (@ (rel "stylesheet") (href "/style.css")))
(title ,title))
(body
(div (@ (class "wrapper"))
,header
(hr)
(div (@ (class "content container"))
(h1 (@ (class "content__title")) ,page-name)
(div (@ (class "content__description")) ,page-desc)
,page-content)
(hr)
,footer
,(map (lambda (l) `(script (@ (src ,l)))) page-scripts)))))
(hr)
,footer)
(append
'("/style.css")
page-styles)
page-scripts
page-meta))

Loading…
Cancel
Save