New website!
cbb304f41b18c2758ba8aa8b8f37f409b1fc95b9
1 parent
7a6c36ba
.gitignore
+1 -6
| 1 | - | Makefile |
|
| 2 | - | publish |
|
| 3 | - | build |
|
| 4 | - | 201* |
|
| 5 | - | .DS_Store |
|
| 6 | - | log/articles/drafts |
|
| 1 | + | index.html |
Makefile
added
+2 -0
| 1 | + | default: |
|
| 2 | + | ./build ~/txt/pub . |
build
added
+97 -0
| 1 | + | #!/usr/bin/env ruby |
|
| 2 | + | ||
| 3 | + | require "pathname" |
|
| 4 | + | require "erb" |
|
| 5 | + | require "commonmarker" |
|
| 6 | + | require "date" |
|
| 7 | + | ||
| 8 | + | PAGE_TEMPLATE = File.read("page.html.erb") |
|
| 9 | + | INDEX_PATH = "index.html" |
|
| 10 | + | ||
| 11 | + | $articles = [] |
|
| 12 | + | ||
| 13 | + | class Page |
|
| 14 | + | def initialize(attrs) |
|
| 15 | + | @title = attrs[:title] |
|
| 16 | + | @name = attrs[:name] |
|
| 17 | + | @year = Date.today.year |
|
| 18 | + | @articles = $articles |
|
| 19 | + | end |
|
| 20 | + | ||
| 21 | + | def to_html |
|
| 22 | + | ERB.new(PAGE_TEMPLATE).result(binding).gsub(/ +$/, '') |
|
| 23 | + | end |
|
| 24 | + | ||
| 25 | + | def styles? |
|
| 26 | + | File.exists? Pathname::new(@name).join("style.css") |
|
| 27 | + | end |
|
| 28 | + | ||
| 29 | + | def write! |
|
| 30 | + | dir = Pathname::new(@name) |
|
| 31 | + | ||
| 32 | + | Dir::mkdir(@name) unless File.exists? dir |
|
| 33 | + | File::new(dir.join("index.html"), "w").write(self.to_html) |
|
| 34 | + | end |
|
| 35 | + | ||
| 36 | + | def method_missing(m, *args) |
|
| 37 | + | self.instance_variable_get("@#{m}") |
|
| 38 | + | end |
|
| 39 | + | end |
|
| 40 | + | ||
| 41 | + | class Article < Page |
|
| 42 | + | def initialize(input, output) |
|
| 43 | + | @output = output |
|
| 44 | + | ||
| 45 | + | abort "#{input} doesn't exist" unless File::exists? input |
|
| 46 | + | puts "* #{input}.." |
|
| 47 | + | ||
| 48 | + | name = File::basename(input, File::extname(input)) |
|
| 49 | + | ||
| 50 | + | @name = name |
|
| 51 | + | @articles = $articles |
|
| 52 | + | @year = self.year |
|
| 53 | + | ||
| 54 | + | header, body = File.read(input).split(/\n\n/, 2) |
|
| 55 | + | result = header && header.strip.match(/^<!--(.*)-->$/m) |
|
| 56 | + | meta = result[1] || abort("article #{input} is not well formed") |
|
| 57 | + | ||
| 58 | + | @body = CommonMarker.render_doc(body, [:FOOTNOTES]).to_html |
|
| 59 | + | ||
| 60 | + | attrs = {} |
|
| 61 | + | meta.strip.each_line do |l| |
|
| 62 | + | matches = l.match(/^(\w+)\s*:\s*(.*)$/) |
|
| 63 | + | attrs[matches[1].downcase.to_sym] = matches[2].chomp |
|
| 64 | + | end |
|
| 65 | + | ||
| 66 | + | @date = attrs[:date] |
|
| 67 | + | @title = attrs[:title] |
|
| 68 | + | end |
|
| 69 | + | end |
|
| 70 | + | ||
| 71 | + | def build!(base, out) |
|
| 72 | + | base = Pathname::new(base) |
|
| 73 | + | out = Pathname::new(out) |
|
| 74 | + | ||
| 75 | + | Dir[base.join("**/**.md")].each do |path| |
|
| 76 | + | path = Pathname::new(path) |
|
| 77 | + | ||
| 78 | + | dir = path.dirname.relative_path_from(base) |
|
| 79 | + | file = path.basename |
|
| 80 | + | ||
| 81 | + | out_dir = out.join(dir) |
|
| 82 | + | out_dir.mkpath() |
|
| 83 | + | out_file = out_dir.join(file.sub_ext(".html")) |
|
| 84 | + | ||
| 85 | + | $articles << Article::new(path, out_file) |
|
| 86 | + | end |
|
| 87 | + | ||
| 88 | + | $articles.each(&:write!) |
|
| 89 | + | ||
| 90 | + | # Index page. |
|
| 91 | + | Page::new(title: "cloudhead's homepage", name: ".").write! |
|
| 92 | + | end |
|
| 93 | + | ||
| 94 | + | base = ARGV.shift |
|
| 95 | + | out = ARGV.shift |
|
| 96 | + | ||
| 97 | + | build!(base, out) |
css/base.css
added
+304 -0
| 1 | + | @charset "utf-8"; |
|
| 2 | + | ||
| 3 | + | :root { |
|
| 4 | + | --highlight-color: aquamarine; |
|
| 5 | + | --subtle-color: #2c4146; |
|
| 6 | + | } |
|
| 7 | + | ||
| 8 | + | * { |
|
| 9 | + | margin: 0; |
|
| 10 | + | padding: 0; |
|
| 11 | + | box-sizing: border-box; |
|
| 12 | + | } |
|
| 13 | + | ||
| 14 | + | body { |
|
| 15 | + | color: #eee; |
|
| 16 | + | background-color: #05050c; |
|
| 17 | + | max-width: 912px; |
|
| 18 | + | margin: 0 auto; |
|
| 19 | + | padding: 120px 0 180px 0; |
|
| 20 | + | line-height: 1.4em; |
|
| 21 | + | font-size: 1.25rem; |
|
| 22 | + | scrollbar-width: thin; |
|
| 23 | + | scrollbar-height: thin; |
|
| 24 | + | scrollbar-color: var(--highlight-color) var(--subtle-color); |
|
| 25 | + | -webkit-font-smoothing: antialiased; |
|
| 26 | + | -moz-osx-font-smoothing: greyscale; |
|
| 27 | + | } |
|
| 28 | + | ||
| 29 | + | body, code, pre, p, kbd, h1, h2, h3, h4, h5 { |
|
| 30 | + | font-family: "Consolas", "Inconsolata", monospace; |
|
| 31 | + | } |
|
| 32 | + | ||
| 33 | + | /* Chrome/Edge/Safari scrollbar */ |
|
| 34 | + | *::-webkit-scrollbar { |
|
| 35 | + | width: 0.5rem; |
|
| 36 | + | height: 0.5rem; |
|
| 37 | + | } |
|
| 38 | + | *::-webkit-scrollbar-track { |
|
| 39 | + | background: transparent; |
|
| 40 | + | } |
|
| 41 | + | *::-webkit-scrollbar-thumb { |
|
| 42 | + | background-color: var(--highlight-color); |
|
| 43 | + | border-radius: 4px; |
|
| 44 | + | } |
|
| 45 | + | ||
| 46 | + | ::selection { |
|
| 47 | + | background: #9fe7e1; |
|
| 48 | + | } |
|
| 49 | + | ||
| 50 | + | :focus { |
|
| 51 | + | outline: none; |
|
| 52 | + | text-decoration: underline; |
|
| 53 | + | } |
|
| 54 | + | ||
| 55 | + | ul, li { |
|
| 56 | + | display: inline-block; |
|
| 57 | + | } |
|
| 58 | + | ||
| 59 | + | li { |
|
| 60 | + | margin: 5px 0; |
|
| 61 | + | display: block; |
|
| 62 | + | } |
|
| 63 | + | ||
| 64 | + | a { |
|
| 65 | + | color: #ffeebb; |
|
| 66 | + | text-decoration: none; |
|
| 67 | + | } |
|
| 68 | + | a:hover { |
|
| 69 | + | text-decoration: underline; |
|
| 70 | + | } |
|
| 71 | + | ||
| 72 | + | strong { |
|
| 73 | + | font-weight: 900; |
|
| 74 | + | } |
|
| 75 | + | ||
| 76 | + | video, img { |
|
| 77 | + | border: 1px solid #888; |
|
| 78 | + | margin: 30px 0; |
|
| 79 | + | outline: none; |
|
| 80 | + | } |
|
| 81 | + | ||
| 82 | + | /* |
|
| 83 | + | * HEADERS |
|
| 84 | + | */ |
|
| 85 | + | ||
| 86 | + | h1, h2, h3, h4 { |
|
| 87 | + | font-family: "Space Mono", "Consolas", monospace; |
|
| 88 | + | font-weight: bold; |
|
| 89 | + | color: var(--highlight-color); |
|
| 90 | + | } |
|
| 91 | + | h3, h4, h5 { |
|
| 92 | + | font-weight: normal !important; |
|
| 93 | + | } |
|
| 94 | + | ||
| 95 | + | h1 { |
|
| 96 | + | font-size: 1.2em; |
|
| 97 | + | line-height: 1.4em; |
|
| 98 | + | font-weight: bold; |
|
| 99 | + | } |
|
| 100 | + | h2 { |
|
| 101 | + | font-size: 1.3em; |
|
| 102 | + | line-height: 1.4em; |
|
| 103 | + | margin-bottom: 30px; |
|
| 104 | + | margin-top: 90px; |
|
| 105 | + | } |
|
| 106 | + | h3 { |
|
| 107 | + | font-size: 1.1em; |
|
| 108 | + | } |
|
| 109 | + | ||
| 110 | + | /* |
|
| 111 | + | * CODE |
|
| 112 | + | */ |
|
| 113 | + | ||
| 114 | + | pre { |
|
| 115 | + | padding: 1.5rem 1.75rem; |
|
| 116 | + | background-color: #060f11; |
|
| 117 | + | border-radius: 4px; |
|
| 118 | + | } |
|
| 119 | + | pre code { |
|
| 120 | + | white-space: pre-wrap; |
|
| 121 | + | } |
|
| 122 | + | ||
| 123 | + | code { |
|
| 124 | + | color: #a1fde6; |
|
| 125 | + | white-space: nowrap; |
|
| 126 | + | font-style: italic; |
|
| 127 | + | } |
|
| 128 | + | code.language-rust { |
|
| 129 | + | color: #ddd; |
|
| 130 | + | font-style: normal; |
|
| 131 | + | } |
|
| 132 | + | code.language-rust .comment { |
|
| 133 | + | color: #4b6267; |
|
| 134 | + | font-style: italic; |
|
| 135 | + | } |
|
| 136 | + | code.language-rust .keyword { |
|
| 137 | + | color: white; |
|
| 138 | + | font-weight: bold; |
|
| 139 | + | } |
|
| 140 | + | code.language-rust .special { |
|
| 141 | + | color: white; |
|
| 142 | + | font-weight: bold; |
|
| 143 | + | } |
|
| 144 | + | code.language-rust .string { |
|
| 145 | + | color: #bbb; |
|
| 146 | + | } |
|
| 147 | + | code.language-rust .number { |
|
| 148 | + | color: #fff897; |
|
| 149 | + | } |
|
| 150 | + | ||
| 151 | + | sup.footnote-ref { |
|
| 152 | + | text-decoration: underline; |
|
| 153 | + | vertical-align: baseline; |
|
| 154 | + | position: relative; |
|
| 155 | + | top: -0.4em; |
|
| 156 | + | } |
|
| 157 | + | ||
| 158 | + | /* |
|
| 159 | + | * NOTE |
|
| 160 | + | */ |
|
| 161 | + | ||
| 162 | + | .note p { |
|
| 163 | + | margin: 1.5rem 0; |
|
| 164 | + | } |
|
| 165 | + | .note p:first-child { |
|
| 166 | + | margin-top: 0; |
|
| 167 | + | } |
|
| 168 | + | .note ul { |
|
| 169 | + | list-style-type: none; |
|
| 170 | + | } |
|
| 171 | + | .note ul, .note ol { |
|
| 172 | + | margin-left: 3rem; |
|
| 173 | + | } |
|
| 174 | + | .note li { |
|
| 175 | + | margin: 0; |
|
| 176 | + | } |
|
| 177 | + | .note ol { |
|
| 178 | + | list-style-type: decimal; |
|
| 179 | + | } |
|
| 180 | + | .note ol li { |
|
| 181 | + | display: list-item; |
|
| 182 | + | } |
|
| 183 | + | .note ol li:marker { |
|
| 184 | + | color: var(--highlight-color); |
|
| 185 | + | } |
|
| 186 | + | .note ul li:before { |
|
| 187 | + | content: 'โ'; |
|
| 188 | + | color: var(--highlight-color); |
|
| 189 | + | position: absolute; |
|
| 190 | + | margin-left: -2rem; |
|
| 191 | + | } |
|
| 192 | + | .note footer { |
|
| 193 | + | text-align: left; |
|
| 194 | + | } |
|
| 195 | + | .note .copy { |
|
| 196 | + | color: var(--subtle-color); |
|
| 197 | + | } |
|
| 198 | + | ||
| 199 | + | /* |
|
| 200 | + | * NAV |
|
| 201 | + | */ |
|
| 202 | + | ||
| 203 | + | nav { |
|
| 204 | + | position: fixed; |
|
| 205 | + | left: 1rem; |
|
| 206 | + | top: 1rem; |
|
| 207 | + | z-index: -1; |
|
| 208 | + | } |
|
| 209 | + | nav li { |
|
| 210 | + | font-size: 20px; |
|
| 211 | + | line-height: 1.25em; |
|
| 212 | + | } |
|
| 213 | + | nav a { |
|
| 214 | + | color: var(--highlight-color); |
|
| 215 | + | } |
|
| 216 | + | nav footer { |
|
| 217 | + | font-size: 1rem; |
|
| 218 | + | color: var(--subtle-color); |
|
| 219 | + | position: fixed; |
|
| 220 | + | bottom: 1rem; |
|
| 221 | + | left: 1rem; |
|
| 222 | + | } |
|
| 223 | + | ||
| 224 | + | /* |
|
| 225 | + | * CLASSES |
|
| 226 | + | */ |
|
| 227 | + | ||
| 228 | + | .date { |
|
| 229 | + | color: #2c4146; |
|
| 230 | + | } |
|
| 231 | + | .subtle { |
|
| 232 | + | color: var(--subtle-color); |
|
| 233 | + | } |
|
| 234 | + | .footnotes { |
|
| 235 | + | margin-top: 2rem; |
|
| 236 | + | padding-top: 2rem; |
|
| 237 | + | border-top: 1px solid var(--subtle-color); |
|
| 238 | + | font-size: 18px; |
|
| 239 | + | } |
|
| 240 | + | .footnotes p { |
|
| 241 | + | margin: 0 !important; |
|
| 242 | + | } |
|
| 243 | + | .footnote-ref a, a[rel="footnote"] { |
|
| 244 | + | margin-left: 0.2rem; |
|
| 245 | + | } |
|
| 246 | + | ||
| 247 | + | /* |
|
| 248 | + | * MEDIA |
|
| 249 | + | */ |
|
| 250 | + | ||
| 251 | + | @media /* Medium desktop */ |
|
| 252 | + | only screen and (max-device-width: 1440px), |
|
| 253 | + | only screen and (max-width: 1440px) { |
|
| 254 | + | nav .subtle { |
|
| 255 | + | display: none; |
|
| 256 | + | } |
|
| 257 | + | } |
|
| 258 | + | ||
| 259 | + | @media /* Small desktop */ |
|
| 260 | + | only screen and (max-device-width: 1280px), |
|
| 261 | + | only screen and (max-width: 1280px) { |
|
| 262 | + | body { |
|
| 263 | + | max-width: 720px; |
|
| 264 | + | } |
|
| 265 | + | } |
|
| 266 | + | ||
| 267 | + | @media /* Smaller desktop */ |
|
| 268 | + | only screen and (max-device-width: 960px), |
|
| 269 | + | only screen and (max-width: 960px) { |
|
| 270 | + | body { |
|
| 271 | + | padding: 1rem; |
|
| 272 | + | } |
|
| 273 | + | nav { |
|
| 274 | + | display: block; |
|
| 275 | + | position: static; |
|
| 276 | + | margin-bottom: 1rem; |
|
| 277 | + | } |
|
| 278 | + | nav ul { |
|
| 279 | + | column-count: 2; |
|
| 280 | + | column-gap: 4em; |
|
| 281 | + | ||
| 282 | + | -webkit-column-count: 2; |
|
| 283 | + | -webkit-column-gap: 4rem; |
|
| 284 | + | -moz-column-count: 2; |
|
| 285 | + | -moz-column-gap: 4rem; |
|
| 286 | + | } |
|
| 287 | + | } |
|
| 288 | + | ||
| 289 | + | @media /* Mobile */ |
|
| 290 | + | only screen and (max-device-width: 720px), |
|
| 291 | + | only screen and (max-width: 720px) { |
|
| 292 | + | video { |
|
| 293 | + | height: auto; |
|
| 294 | + | width: 100%; |
|
| 295 | + | border-left: none; |
|
| 296 | + | border-right: none; |
|
| 297 | + | } |
|
| 298 | + | pre { |
|
| 299 | + | overflow: scroll !important; |
|
| 300 | + | } |
|
| 301 | + | pre code { |
|
| 302 | + | white-space: pre !important; |
|
| 303 | + | } |
|
| 304 | + | } |
css/fonts.css
added
+28 -0
| 1 | + | @font-face { |
|
| 2 | + | font-family: 'Space Mono'; |
|
| 3 | + | font-style: italic; |
|
| 4 | + | font-weight: 400; |
|
| 5 | + | src: local('Space Mono Italic'), local('SpaceMono-Italic'), url(/fonts/SpaceMono-Italic.ttf) format('woff2'); |
|
| 6 | + | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; |
|
| 7 | + | } |
|
| 8 | + | @font-face { |
|
| 9 | + | font-family: 'Space Mono'; |
|
| 10 | + | font-style: italic; |
|
| 11 | + | font-weight: 700; |
|
| 12 | + | src: local('Space Mono Bold Italic'), local('SpaceMono-BoldItalic'), url(/fonts/SpaceMono-BoldItalic.ttf) format('woff2'); |
|
| 13 | + | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; |
|
| 14 | + | } |
|
| 15 | + | @font-face { |
|
| 16 | + | font-family: 'Space Mono'; |
|
| 17 | + | font-style: normal; |
|
| 18 | + | font-weight: 400; |
|
| 19 | + | src: local('Space Mono'), local('SpaceMono-Regular'), url(/fonts/SpaceMono-Regular.ttf) format('woff2'); |
|
| 20 | + | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; |
|
| 21 | + | } |
|
| 22 | + | @font-face { |
|
| 23 | + | font-family: 'Space Mono'; |
|
| 24 | + | font-style: normal; |
|
| 25 | + | font-weight: 700; |
|
| 26 | + | src: local('Space Mono Bold'), local('SpaceMono-Bold'), url(/fonts/SpaceMono-Bold.ttf) format('woff2'); |
|
| 27 | + | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; |
|
| 28 | + | } |
data/links.txt
deleted
+0 -12
| 1 | - | ||
| 2 | - | * Principia Discordia <http://www.principiadiscordia.com/book/1.php> |
|
| 3 | - | ||
| 4 | - | Essential reading if you want to understand life. |
|
| 5 | - | ||
| 6 | - | * Learn VimScript the Hard Way <http://learnvimscriptthehardway.stevelosh.com/> |
|
| 7 | - | ||
| 8 | - | A pretty great vim reference. |
|
| 9 | - | ||
| 10 | - | * Vim script cheatsheet <http://ricostacruz.com/cheatsheets/vimscript.html> |
|
| 11 | - | ||
| 12 | - | A beautiful VimL cheatsheet. |
fonts/SpaceMono-Bold.ttf
added
+0 -0
Binary file changed.
fonts/SpaceMono-BoldItalic.ttf
added
+0 -0
Binary file changed.
fonts/SpaceMono-Italic.ttf
added
+0 -0
Binary file changed.
fonts/SpaceMono-Regular.ttf
added
+0 -0
Binary file changed.
index.html
deleted
+0 -27
| 1 | - | <!doctype html> |
|
| 2 | - | <html lang="en"> |
|
| 3 | - | <head> |
|
| 4 | - | <link rel="stylesheet" type="text/css" href="css/index.css"> |
|
| 5 | - | <title>cloudhead.io</title> |
|
| 6 | - | </head> |
|
| 7 | - | <body> |
|
| 8 | - | <header> |
|
| 9 | - | <nav> |
|
| 10 | - | <h1>cloudhead</h1> |
|
| 11 | - | <ul> |
|
| 12 | - | <li><a href="https://github.com/cloudhead">code</a></li> |
|
| 13 | - | <li><a href="https://twitter.com/cloudhead">tweets</a></li> |
|
| 14 | - | <li><a href="https://merveilles.town/@cloudhead">toots</a></li> |
|
| 15 | - | <li><a href="https://ello.co/cloudhead">drawings</a></li> |
|
| 16 | - | <li><a href="https://github.com/cloudhead/dotfiles">dotfiles</a></li> |
|
| 17 | - | <li><a href="https://github.com/cloudhead/shady.vim">shady</a></li> |
|
| 18 | - | <li><a href="https://rx.cloudhead.io">rx</a></li> |
|
| 19 | - | </ul> |
|
| 20 | - | </nav> |
|
| 21 | - | </header> |
|
| 22 | - | <footer> |
|
| 23 | - | <a href="mailto:hello@cloudhead.io">hello@cloudhead.io</a> |
|
| 24 | - | <p>© 2010-2019 Alexis Sellier</p> |
|
| 25 | - | </footer> |
|
| 26 | - | </body> |
|
| 27 | - | </html> |
js/hirust.js
added
+97 -0
| 1 | + | (function (hirust) { |
|
| 2 | + | // |
|
| 3 | + | // hirust - Rust Syntax Highlighter |
|
| 4 | + | // |
|
| 5 | + | // Copyright (c) 2020 Alexis Sellier |
|
| 6 | + | // |
|
| 7 | + | ||
| 8 | + | // All elements which match this will be syntax highlighted. |
|
| 9 | + | var selector = hirust || '.language-rust'; |
|
| 10 | + | ||
| 11 | + | var keywords = ('fn pub if else for while break match struct type let impl ref mut use mod self ' |
|
| 12 | + | +'continue return true false panic! loop').split(' '), |
|
| 13 | + | special = ('Ok Err Result').split(' '); |
|
| 14 | + | ||
| 15 | + | // Syntax definition. |
|
| 16 | + | // |
|
| 17 | + | // The key becomes the class name of the <span> around the matched block of code. |
|
| 18 | + | var syntax = [ |
|
| 19 | + | ['comment', /(\/\/[^\n]*)/g], |
|
| 20 | + | ['string' , /("(?:(?!")[^\\\n]|\\.)*"|'(?:(?!')[^\\\n]|\\.)*')/g], |
|
| 21 | + | ['number' , /\b([0-9]+(?:\.[0-9]+)?)\b/g], |
|
| 22 | + | ['keyword', new(RegExp)('\\b(' + keywords.join('|') + ')\\b', 'g')], |
|
| 23 | + | ['special', new(RegExp)('\\b(' + special.join('|') + ')\\b', 'g')] |
|
| 24 | + | ]; |
|
| 25 | + | var nodes, table = {}; |
|
| 26 | + | ||
| 27 | + | if (/^[a-z]+$/.test(selector)) { |
|
| 28 | + | nodes = document.getElementsByTagName(selector); |
|
| 29 | + | } else if (/^\.[\w-]+$/.test(selector)) { |
|
| 30 | + | nodes = document.getElementsByClassName(selector.slice(1)); |
|
| 31 | + | } else if (document.querySelectorAll) { |
|
| 32 | + | nodes = document.querySelectorAll(selector); |
|
| 33 | + | } else { |
|
| 34 | + | nodes = []; |
|
| 35 | + | } |
|
| 36 | + | ||
| 37 | + | for (var i = 0, children; i < nodes.length; i++) { |
|
| 38 | + | children = nodes[i].childNodes; |
|
| 39 | + | ||
| 40 | + | for (var j = 0, str; j < children.length; j++) { |
|
| 41 | + | code = children[j]; |
|
| 42 | + | ||
| 43 | + | if (code.length >= 0) { // It's a text node |
|
| 44 | + | // Don't highlight command-line snippets |
|
| 45 | + | if (! /^\$\s/.test(code.nodeValue.trim())) { |
|
| 46 | + | syntax.forEach(function (s) { |
|
| 47 | + | var k = s[0], v = s[1]; |
|
| 48 | + | code.nodeValue = code.nodeValue.replace(v, function (_, m) { |
|
| 49 | + | return '\u00ab' + encode(k) + '\u00b7' |
|
| 50 | + | + encode(m) + |
|
| 51 | + | '\u00b7' + encode(k) + '\u00bb'; |
|
| 52 | + | }); |
|
| 53 | + | }); |
|
| 54 | + | } |
|
| 55 | + | } |
|
| 56 | + | } |
|
| 57 | + | } |
|
| 58 | + | ||
| 59 | + | for (var i = 0; i < nodes.length; i++) { |
|
| 60 | + | nodes[i].innerHTML = |
|
| 61 | + | nodes[i].innerHTML.replace(/\u00ab(.+?)\u00b7(.+?)\u00b7\1\u00bb/g, |
|
| 62 | + | function (_, name, value) { |
|
| 63 | + | value = value.replace(/\u00ab[^\u00b7]+\u00b7/g, '') |
|
| 64 | + | .replace(/\u00b7[^\u00bb]+\u00bb/g, ''); |
|
| 65 | + | ||
| 66 | + | return '<span class="' + decode(name) + '">' |
|
| 67 | + | + escape(decode(value)) |
|
| 68 | + | + '</span>'; |
|
| 69 | + | }); |
|
| 70 | + | } |
|
| 71 | + | ||
| 72 | + | function escape(str) { |
|
| 73 | + | return str.replace(/</g, '<').replace(/>/g, '>'); |
|
| 74 | + | } |
|
| 75 | + | ||
| 76 | + | // Encode ASCII characters to, and from Braille |
|
| 77 | + | function encode (str, encoded) { |
|
| 78 | + | table[encoded = str.split('').map(function (s) { |
|
| 79 | + | if (s.charCodeAt(0) > 127) { return s } |
|
| 80 | + | return String.fromCharCode(s.charCodeAt(0) + 0x2800); |
|
| 81 | + | }).join('')] = str; |
|
| 82 | + | ||
| 83 | + | return encoded; |
|
| 84 | + | } |
|
| 85 | + | ||
| 86 | + | function decode (str) { |
|
| 87 | + | if (str in table) { |
|
| 88 | + | return table[str]; |
|
| 89 | + | } else { |
|
| 90 | + | return str.trim().split('').map(function (s) { |
|
| 91 | + | if (s.charCodeAt(0) - 0x2800 > 127) { return s } |
|
| 92 | + | return String.fromCharCode(s.charCodeAt(0) - 0x2800); |
|
| 93 | + | }).join(''); |
|
| 94 | + | } |
|
| 95 | + | } |
|
| 96 | + | ||
| 97 | + | })(window.hirust); |
links/links.css
deleted
+0 -38
| 1 | - | body { |
|
| 2 | - | padding: 10px; |
|
| 3 | - | font-size: 14px; |
|
| 4 | - | } |
|
| 5 | - | ||
| 6 | - | h1 { |
|
| 7 | - | font-size: 16px; |
|
| 8 | - | } |
|
| 9 | - | ||
| 10 | - | h2 { |
|
| 11 | - | font-size: 20px; |
|
| 12 | - | text-decoration: underline; |
|
| 13 | - | } |
|
| 14 | - | ||
| 15 | - | h3 { |
|
| 16 | - | font-size: 20px; |
|
| 17 | - | } |
|
| 18 | - | ||
| 19 | - | section > header { |
|
| 20 | - | margin-bottom: 10px; |
|
| 21 | - | } |
|
| 22 | - | ||
| 23 | - | section > header > h2 { |
|
| 24 | - | font-size: 20px; |
|
| 25 | - | } |
|
| 26 | - | ||
| 27 | - | li { |
|
| 28 | - | list-style-position: inside; |
|
| 29 | - | margin: 10px 0; |
|
| 30 | - | } |
|
| 31 | - | ||
| 32 | - | section p { |
|
| 33 | - | margin: 15px 0 30px 0; |
|
| 34 | - | } |
|
| 35 | - | ||
| 36 | - | a:hover { |
|
| 37 | - | text-decoration: underline; |
|
| 38 | - | } |
log/_article.html.erb
deleted
+0 -26
| 1 | - | <!doctype html> |
|
| 2 | - | <html lang="en"> |
|
| 3 | - | <head> |
|
| 4 | - | <title>cloudhead.io</title> |
|
| 5 | - | <link rel="stylesheet" type="text/css" href="/log/log.css"> |
|
| 6 | - | </head> |
|
| 7 | - | <body class="essay"> |
|
| 8 | - | <header> |
|
| 9 | - | <nav><a href="/">cloudhead.io</a>/<a href="/log">log</a></nav> |
|
| 10 | - | </header> |
|
| 11 | - | <article class="post"> |
|
| 12 | - | <header> |
|
| 13 | - | <h1><%= title %></h1> |
|
| 14 | - | <span class="date"><%= date %></span> |
|
| 15 | - | </header> |
|
| 16 | - | <section class="body"> |
|
| 17 | - | <%= body %> |
|
| 18 | - | </section> |
|
| 19 | - | </article> |
|
| 20 | - | <footer> |
|
| 21 | - | <p>follow me <a href="http://twitter.com/cloudhead">@cloudhead</a></br /> |
|
| 22 | - | <a href="mailto:hello@cloudhead.io">comments@cloudhead.io</a></p> |
|
| 23 | - | <p class="copy">© 2010-2013 Alexis Sellier</p> |
|
| 24 | - | </footer> |
|
| 25 | - | </body> |
|
| 26 | - | </html> |
log/index.html
deleted
+0 -26
| 1 | - | <!doctype html> |
|
| 2 | - | <html lang="en"> |
|
| 3 | - | <head> |
|
| 4 | - | <link rel="stylesheet" type="text/css" href="log.css"> |
|
| 5 | - | <title>cloudhead.io</title> |
|
| 6 | - | </head> |
|
| 7 | - | <body class="essays"> |
|
| 8 | - | <header> |
|
| 9 | - | <nav><a href="/">cloudhead.io</a>/essays</nav> |
|
| 10 | - | </header> |
|
| 11 | - | <section> |
|
| 12 | - | <header> |
|
| 13 | - | <h2>misc.</h2> |
|
| 14 | - | </header> |
|
| 15 | - | <ul> |
|
| 16 | - | ||
| 17 | - | <li><a href="/2010/04/24/staying-the-hell-out-of-insert-mode">Staying the hell out of insert mode</a><span class="date">April 24th 2010</li> |
|
| 18 | - | ||
| 19 | - | </ul> |
|
| 20 | - | </section> |
|
| 21 | - | <footer> |
|
| 22 | - | <a href="mailto:hello@cloudhead.io">comments@cloudhead.io</a> |
|
| 23 | - | <p>© 2010-2013 Alexis Sellier</p> |
|
| 24 | - | </footer> |
|
| 25 | - | </body> |
|
| 26 | - | </html> |
log/index.html.erb
deleted
+0 -26
| 1 | - | <!doctype html> |
|
| 2 | - | <html lang="en"> |
|
| 3 | - | <head> |
|
| 4 | - | <link rel="stylesheet" type="text/css" href="log.css"> |
|
| 5 | - | <title>cloudhead.io</title> |
|
| 6 | - | </head> |
|
| 7 | - | <body class="essays"> |
|
| 8 | - | <header> |
|
| 9 | - | <nav><a href="/">cloudhead.io</a>/essays</nav> |
|
| 10 | - | </header> |
|
| 11 | - | <section> |
|
| 12 | - | <header> |
|
| 13 | - | <h2>misc.</h2> |
|
| 14 | - | </header> |
|
| 15 | - | <ul> |
|
| 16 | - | <% articles.each do |a| %> |
|
| 17 | - | <li><a href="<%= a.path %>"><%= a.title %></a><span class="date"><%= a.date %></li> |
|
| 18 | - | <% end %> |
|
| 19 | - | </ul> |
|
| 20 | - | </section> |
|
| 21 | - | <footer> |
|
| 22 | - | <a href="mailto:hello@cloudhead.io">comments@cloudhead.io</a> |
|
| 23 | - | <p>© 2010-2013 Alexis Sellier</p> |
|
| 24 | - | </footer> |
|
| 25 | - | </body> |
|
| 26 | - | </html> |
log/log.css
deleted
+0 -110
| 1 | - | @import url("/css/base.css"); |
|
| 2 | - | ||
| 3 | - | /* Essay list page */ |
|
| 4 | - | ||
| 5 | - | body.essays { |
|
| 6 | - | font-size: 20px; |
|
| 7 | - | } |
|
| 8 | - | ||
| 9 | - | body.essays section { |
|
| 10 | - | padding: 10px; |
|
| 11 | - | } |
|
| 12 | - | ||
| 13 | - | body.essays section > header { |
|
| 14 | - | margin-bottom: 10px; |
|
| 15 | - | } |
|
| 16 | - | ||
| 17 | - | body.essays section > header > h2 { |
|
| 18 | - | font-size: 20px; |
|
| 19 | - | } |
|
| 20 | - | ||
| 21 | - | body.essays footer { |
|
| 22 | - | text-align: right; |
|
| 23 | - | position: fixed; |
|
| 24 | - | bottom: 10px; |
|
| 25 | - | right: 10px; |
|
| 26 | - | font-size: 11px; |
|
| 27 | - | } |
|
| 28 | - | ||
| 29 | - | body.essays footer a { |
|
| 30 | - | font-size: 17px; |
|
| 31 | - | } |
|
| 32 | - | ||
| 33 | - | body.essays li { |
|
| 34 | - | font-family: "Times New Roman", serif; |
|
| 35 | - | margin: 5px 0; |
|
| 36 | - | } |
|
| 37 | - | ||
| 38 | - | body.essays li .date { |
|
| 39 | - | float: right; |
|
| 40 | - | color: #999; |
|
| 41 | - | } |
|
| 42 | - | ||
| 43 | - | body.essays section p { |
|
| 44 | - | margin: 30px 0; |
|
| 45 | - | } |
|
| 46 | - | ||
| 47 | - | /* Essay view page */ |
|
| 48 | - | ||
| 49 | - | body.essay { |
|
| 50 | - | font-family: "Times New Roman", Times, serif; |
|
| 51 | - | font-size: 24px; |
|
| 52 | - | } |
|
| 53 | - | body.essay > footer { |
|
| 54 | - | font-family: courier, monospace; |
|
| 55 | - | } |
|
| 56 | - | body.essay footer { |
|
| 57 | - | text-align: center; |
|
| 58 | - | margin: 0 auto; |
|
| 59 | - | padding: 15px 0 45px 0; |
|
| 60 | - | font-size: 21px; |
|
| 61 | - | line-height: 1.6em; |
|
| 62 | - | } |
|
| 63 | - | body.essay footer .copy { |
|
| 64 | - | font-size: 14px; |
|
| 65 | - | } |
|
| 66 | - | ||
| 67 | - | .post { |
|
| 68 | - | padding-top: 90px; |
|
| 69 | - | } |
|
| 70 | - | .post a:hover { |
|
| 71 | - | text-decoration: underline; |
|
| 72 | - | } |
|
| 73 | - | .post p:first-child { |
|
| 74 | - | margin-top: 0; |
|
| 75 | - | } |
|
| 76 | - | .post .body, .post header { |
|
| 77 | - | width: 800px; |
|
| 78 | - | margin: 0 auto; |
|
| 79 | - | text-align: left; |
|
| 80 | - | } |
|
| 81 | - | .post header { |
|
| 82 | - | margin-bottom: 1.5em; |
|
| 83 | - | } |
|
| 84 | - | .post .body, .post code, .post h2 { |
|
| 85 | - | font-size: 24px; |
|
| 86 | - | line-height: 1.4em; |
|
| 87 | - | } |
|
| 88 | - | .post .date { |
|
| 89 | - | display: block; |
|
| 90 | - | padding-top: 10px; |
|
| 91 | - | font-size: 20px; |
|
| 92 | - | } |
|
| 93 | - | .post .date, .post blockquote { |
|
| 94 | - | color: #777; |
|
| 95 | - | } |
|
| 96 | - | .post blockquote { |
|
| 97 | - | font-style: italic; |
|
| 98 | - | } |
|
| 99 | - | .post pre { |
|
| 100 | - | margin-left: 10px; |
|
| 101 | - | } |
|
| 102 | - | .post code { |
|
| 103 | - | font-family: courier, monospace; |
|
| 104 | - | } |
|
| 105 | - | .post p { |
|
| 106 | - | margin: 1.5em 0; |
|
| 107 | - | } |
|
| 108 | - | .post h1 { |
|
| 109 | - | font-size: 42px; |
|
| 110 | - | } |
page.html.erb
added
+51 -0
| 1 | + | <!doctype html> |
|
| 2 | + | <html lang="en"> |
|
| 3 | + | <head> |
|
| 4 | + | <title><%= title %></title> |
|
| 5 | + | <meta charset="utf-8"> |
|
| 6 | + | <link rel="stylesheet" type="text/css" href="/css/fonts.css"> |
|
| 7 | + | <link rel="stylesheet" type="text/css" href="/css/base.css"> |
|
| 8 | + | <% if styles? %> |
|
| 9 | + | <link rel="stylesheet" type="text/css" href="style.css"> |
|
| 10 | + | <% end %> |
|
| 11 | + | </head> |
|
| 12 | + | <body> |
|
| 13 | + | <nav> |
|
| 14 | + | <ul> |
|
| 15 | + | <li><a href="/">/</a> <span class="subtle">home</span></li> |
|
| 16 | + | <li><a href="http://twitter.com/cloudhead">@cloudhead</a> <span class="subtle">follow my tweets</span></li> |
|
| 17 | + | <li><a href="https://github.com/cloudhead">code</a> <span class="subtle">github.com/cloudhead</span></li> |
|
| 18 | + | <li><a href="https://github.com/cloudhead/dotfiles">dotfiles</a> <span class="subtle">~/.*</span></li> |
|
| 19 | + | <li><a href="https://github.com/cloudhead/shady.vim">shady</a> <span class="subtle">:colorscheme</span</li> |
|
| 20 | + | <li><a href="https://rx.cloudhead.io">rx</a> <span class="subtle">rx.cloudhead.io</span></li> |
|
| 21 | + | <% articles.each do |a| %> |
|
| 22 | + | <li><a href="/<%= a.name %>/"><%= a.name %></a> <span class="subtle"><%= a.date %></li> |
|
| 23 | + | <% end %> |
|
| 24 | + | <li><a href="https://twitter.com/cloudhead">tweets</a></li> |
|
| 25 | + | <li><a href="https://merveilles.town/@cloudhead">toots</a></li> |
|
| 26 | + | <li><a href="https://ello.co/cloudhead">drawings</a></li> |
|
| 27 | + | </ul> |
|
| 28 | + | <footer> |
|
| 29 | + | © <%= year %> Alexis Sellier |
|
| 30 | + | </footer> |
|
| 31 | + | </nav> |
|
| 32 | + | <% if body %> |
|
| 33 | + | <article class="note"> |
|
| 34 | + | <% if title %> |
|
| 35 | + | <header> |
|
| 36 | + | <h1><%= title %></h1> |
|
| 37 | + | <% if date %> |
|
| 38 | + | <p class="date"><%= date %></p> |
|
| 39 | + | <% end %> |
|
| 40 | + | </header> |
|
| 41 | + | <% end %> |
|
| 42 | + | <section class="body"> |
|
| 43 | + | <%= body %> |
|
| 44 | + | </section> |
|
| 45 | + | <footer> |
|
| 46 | + | </footer> |
|
| 47 | + | </article> |
|
| 48 | + | <script type="text/javascript" src="/js/hirust.js"></script> |
|
| 49 | + | <% end %> |
|
| 50 | + | </body> |
|
| 51 | + | </html> |
css/index.css → style.css
renamed
+4 -24
| 1 | - | * { |
|
| 2 | - | margin: 0; |
|
| 3 | - | padding: 0; |
|
| 4 | - | } |
|
| 5 | - | ||
| 6 | 1 | body { |
|
| 7 | 2 | background: url(/images/bg.png) no-repeat fixed bottom center; |
|
| 8 | - | padding: 16px; |
|
| 9 | - | font-size: 20px; |
|
| 10 | - | font-family: monospace; |
|
| 11 | 3 | } |
|
| 12 | 4 | ||
| 13 | 5 | h1 { |
|
| 14 | 6 | font-size: 20px; |
|
| 15 | 7 | text-shadow: -2px -2px white; |
| 28 | 20 | li { |
|
| 29 | 21 | margin: 5px 0; |
|
| 30 | 22 | display: block; |
|
| 31 | 23 | } |
|
| 32 | 24 | ||
| 33 | - | a { |
|
| 34 | - | text-decoration: none; |
|
| 35 | - | } |
|
| 36 | - | ||
| 37 | - | a:hover { |
|
| 38 | - | text-decoration: underline; |
|
| 39 | - | } |
|
| 40 | - | ||
| 41 | - | footer { |
|
| 42 | - | text-align: right; |
|
| 43 | - | position: fixed; |
|
| 44 | - | bottom: 10px; |
|
| 45 | - | right: 10px; |
|
| 46 | - | font-size: 11px; |
|
| 25 | + | nav a { |
|
| 26 | + | color: black; |
|
| 47 | 27 | } |
|
| 48 | 28 | ||
| 49 | - | footer a { |
|
| 50 | - | font-size: 16px; |
|
| 29 | + | nav footer, .subtle, .date { |
|
| 30 | + | color: #bbb; |
|
| 51 | 31 | } |