root/html-wrapper.scm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(define-module (html-wrapper)
  #:export (html-wrapper))

(define (str-replace str find-char replace-str)
  (string-join (string-split str find-char) replace-str))

(define (minimize-css css)
  css
  ;; (str-replace (str-replace (str-replace css #\space "")
  ;;                           #\newline "") #\} "} ")
  )

(define mincss (minimize-css
                "body{font-family:Mono;}
 .file-view .contents {white-space: nowrap;}
 .line-numbers{ padding-right:4px; border-top: solid gray 1px; border-bottom: solid gray 1px; padding-top:2px; padding-bottom:2px;}
 .file-content{ padding-left:5px; border-left: solid gray 1px; border-top: solid gray 1px; border-bottom: solid gray 1px; padding-top:2px; padding-bottom:2px;}
 .file-view pre {
display: inline-block;
background: #fefefe;
background-image: -webkit-linear-gradient(#fefefe 50%, #f7f7f7 50%);
background-image:    -moz-linear-gradient(#fefefe 50%, #f7f7f7 50%);
background-image:     -ms-linear-gradient(#fefefe 50%, #f7f7f7 50%);
background-image:      -o-linear-gradient(#fefefe 50%, #f7f7f7 50%);
background-image:         linear-gradient(#fefefe 50%, #f7f7f7 50%);
background-position: 2px 2px;
background-repeat: repeat;
background-size: 2.5em 2.5em;
line-height: 1.25em;
font-size: 1em;}
.rendered-markup.org p, .rendered-markup.org h1, .rendered-markup.org h2, .rendered-markup.org h3, .rendered-markup.org h4 {margin: 0px;}"))

(define (html-wrapper content)
  `(html
    (head (style ,mincss)
          (meta (@ (http-equiv "content-type") (content "text/html; charset=utf-8"))))
    (body ,content)))