| 1 | (use text.html-lite) |
|---|
| 2 | (use text.tree) |
|---|
| 3 | (use www.cgi) |
|---|
| 4 | |
|---|
| 5 | (define (result stash-table) |
|---|
| 6 | (define (stash name) |
|---|
| 7 | (html-escape-string (hash-table-get stash-table name))) |
|---|
| 8 | (define (stash-raw name) |
|---|
| 9 | (hash-table-get stash-table name)) |
|---|
| 10 | |
|---|
| 11 | `(,(if (null? (stash-raw 'files)) |
|---|
| 12 | (cgi-header :content-type "text/html; charset=UTF-8" :status "404 Not Found") |
|---|
| 13 | (cgi-header :content-type "text/html; charset=UTF-8")) |
|---|
| 14 | ,(html-doctype :type :xhtml-1.0-strict) |
|---|
| 15 | ,(html:html |
|---|
| 16 | (html:head |
|---|
| 17 | (html:title (stash 'title)) |
|---|
| 18 | (html:meta :name "keywords" :content "norobot") |
|---|
| 19 | (html:link :rel "alternate" :type "application/rss+xml" :title "RSS" :href (string-join (list (stash 'home) "/index.rdf") "")) |
|---|
| 20 | (html:style :type "text/css" " |
|---|
| 21 | body { |
|---|
| 22 | background: #fff; |
|---|
| 23 | color: #555; |
|---|
| 24 | padding: 0 10%; |
|---|
| 25 | line-height: 1.75; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | var { |
|---|
| 29 | text-decoration: underline; |
|---|
| 30 | color: #666; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | hr { |
|---|
| 34 | border-style: solid; |
|---|
| 35 | border-width: 1px 0 0; |
|---|
| 36 | border-color: #eee; |
|---|
| 37 | height: 1px; |
|---|
| 38 | margin: 1em 0; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | .all { |
|---|
| 42 | width: 45em; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | a:link { |
|---|
| 46 | color: #d06c6b; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | a:visited { |
|---|
| 50 | color: #b44e4d; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | a:hover { |
|---|
| 54 | text-decoration: none; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | h1, h2, h3 { |
|---|
| 58 | font-weight: normal; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | .hentry { |
|---|
| 62 | border-top: 1px solid #ddd; |
|---|
| 63 | padding: 1em 0; |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | h3 { |
|---|
| 67 | color: #d06c6b; |
|---|
| 68 | margin: 0 0 1em 0; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | dl.information { |
|---|
| 72 | margin: 0; |
|---|
| 73 | color: #ccc; |
|---|
| 74 | font-size: 80%; |
|---|
| 75 | text-align: right; |
|---|
| 76 | line-height: 1.33; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | dt { |
|---|
| 80 | margin: 0 13em 0 0; |
|---|
| 81 | padding: 0; |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | dd { |
|---|
| 85 | overflow: hidden; |
|---|
| 86 | white-space: nowrap; |
|---|
| 87 | padding: 0; |
|---|
| 88 | margin: -1.33em 0 0 0; |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | #top a:link, |
|---|
| 92 | #top a:visited, |
|---|
| 93 | #top a:hover, |
|---|
| 94 | #top a { |
|---|
| 95 | text-decoration: none; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | #footer { |
|---|
| 99 | font-size: 80%; |
|---|
| 100 | color: #999; |
|---|
| 101 | text-align: center; |
|---|
| 102 | } |
|---|
| 103 | ") |
|---|
| 104 | ) |
|---|
| 105 | (html:body |
|---|
| 106 | (html:div |
|---|
| 107 | :class "all" |
|---|
| 108 | (html:h1 :id "top" (html:a :href (string-append (stash 'home) "/") (stash 'title))) |
|---|
| 109 | (if (null? (stash-raw 'files)) |
|---|
| 110 | (html:div :class "section notfound" |
|---|
| 111 | (html:p #`"404 Not Found ,(path-info)")) |
|---|
| 112 | (list |
|---|
| 113 | (html:div :class "section hfeed" |
|---|
| 114 | (html:h2 "Days") |
|---|
| 115 | (map (lambda (file) |
|---|
| 116 | (html:div :class "hentry" |
|---|
| 117 | (html:h3 :class "entry-title" |
|---|
| 118 | (html:a :href (string-join (list (stash 'home) (file 'name)) "") |
|---|
| 119 | :rel "bookmark" |
|---|
| 120 | (html-escape-string (file 'title)))) |
|---|
| 121 | (html:div :class "entry-content" |
|---|
| 122 | (string-join (file 'body) "\n")) |
|---|
| 123 | (html:dl :class "information" |
|---|
| 124 | (html:dt "DateTime") |
|---|
| 125 | (html:dd (html:abbr :class "entry-updated" |
|---|
| 126 | :title (date->string (file 'date) "~Y-~m-~dT~H:~M:~S+09:00") |
|---|
| 127 | (date->string (file 'date) "~Y-~m-~d ~H:~M:~S"))) |
|---|
| 128 | (html:dt "Path") |
|---|
| 129 | (html:dd (file 'name)) |
|---|
| 130 | (html:dt "Author") |
|---|
| 131 | (html:dd :class "vcard author" (html:span :class "fn" *author*)) |
|---|
| 132 | ) |
|---|
| 133 | )) |
|---|
| 134 | (stash-raw 'files))) |
|---|
| 135 | (html:div :class "paging" |
|---|
| 136 | (let ([num 0] |
|---|
| 137 | [current (+ (stash-raw 'page-current) 1)]) |
|---|
| 138 | (map (lambda (page) |
|---|
| 139 | (inc! num) |
|---|
| 140 | (if (= num current) |
|---|
| 141 | (html:span :class "current" num " ") |
|---|
| 142 | (html:span |
|---|
| 143 | (html:a :href #`"?page=,num" num) |
|---|
| 144 | " " |
|---|
| 145 | )) |
|---|
| 146 | ) |
|---|
| 147 | (stash-raw 'page-slices))) |
|---|
| 148 | ) |
|---|
| 149 | ) |
|---|
| 150 | ) |
|---|
| 151 | (html:div :id "footer" |
|---|
| 152 | (html:p |
|---|
| 153 | "Gauche " |
|---|
| 154 | (gauche-version) |
|---|
| 155 | " on " |
|---|
| 156 | (gauche-architecture)) |
|---|
| 157 | (html:p (html:a :href "http://d.hatena.ne.jp/jknaoya/" "id:jknaoya")) |
|---|
| 158 | ) |
|---|
| 159 | ) ; /div.all |
|---|
| 160 | ) ; /body |
|---|
| 161 | ) ; /html |
|---|
| 162 | ) |
|---|
| 163 | ) |
|---|