blob: 42ec5157dc682dd95a0f5209c84e9b5e2bd5aa19 (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/usr/bin/env ruby
MEDIA_DIR = '/srv/media'
MEDIA_URL = 'https://media.pdp8.info'
WWW_DIR = '/srv/www/pdp8-test'
SNIPPETS = File.join(File.dirname(__FILE__), 'html')
def nav(cat)
html = "
<nav>
<div class='menu'>
<a id='logo' href='/about.html'><img src='/pdp8.png' alt='pdp8 logo'></a>
<div class='site'>
"
%w[music pictures videos climbing code contact].each do |c|
html += '<a '
html += "class='current' " if c == cat
html += "href='/#{c}.html'>#{c}</a>"
end
html += "
<a #{cat == 'social' ? 'class="current"' : ''} href='/social/create.html'>social</a>
<a href='/rss.xml'>rss</a>
</div>
</div>
<div class='webring'>
<div>
<a href='https://fediring.net/' class='ring'>fediring:</a>
<a href='https://fediring.net/previous?host=pdp8.info'>←</a>
<a href='https://fediring.net/random'>random</a>
<a href='https://fediring.net/next?host=pdp8.info'>→</a>
</div>
<div>
<a href='https://faircamp.webr.ing/' class='ring'>faircamp:</a>
<a href='https://faircamp.webr.ing/prev/pdp8.info/music.html'>←</a>
<a href='https://faircamp.webr.ing/rand'>random</a>
<a href='https://faircamp.webr.ing/next/pdp8.info/music.html'>→</a>
</div>
</div>
</nav>
"
html
end
def print_html(basename, html)
out = File.join(WWW_DIR, basename + '.html')
puts out
File.open(out, 'w+') { |f| f.puts html }
puts `tidy -iqm -w 0 #{out} 2>&1`
end
|