2 # Copyright (C) 2016 Ian Kelling
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 Dir
.chdir(File
.join(File
.dirname(__FILE__
), '_site'))
27 blog_list
= [] # table data
30 FileUtils
.mkdir_p('../proposed-comments')
31 FileUtils
.chmod(0777, '../proposed-comments')
32 FileUtils
.rm Dir
.glob('blog/*')
35 # date has no type affinity, since floating point (REAL) doesn't
36 # have an appropriate one.
38 create table if not exists c (
39 id integer primary key,
48 FileUtils
.chmod(0777, '../proposed-comments/comments.sqlite')
50 # We assume blog entry files are prefixed by date
51 # so we can just sort the filenames.
52 Dir
.glob('../blog/*.md').sort
.reverse
.each
do |file
|
53 [feed_entries
, blog_list
].zip(post(file
, true)) { |arr
, new
| arr
<< new
}
55 FileUtils
.chmod_R(0777, 'blog')
56 FileUtils
.mkdir_p('../comments/blog')
57 FileUtils
.chmod_R(0777, '../comments')
60 # main reference doc https://validator.w3.org/feed/docs/atom.html
61 # Reference doc says updated should be last time it changed
62 # but jekyll's rss feed just uses current time, which is easier to get,
63 # so meh, i'll just use that.
64 fwrite('feed.xml', <<EOF)
65 <?xml version="1.0" encoding="UTF-8"?>
66 <feed xmlns="http://www.w3.org/2005/Atom" >
68 <name>Ian Kelling</name>
72 <link rel="self" href="#{DURL}"/>
73 <title>Ian Kelling's Blog</title>
74 <updated>#{Time.now.to_datetime.rfc3339}</updated>
75 #{feed_entries.join("\n")}
79 fskel('index.html', DN
, File
.read('../index.html'))
81 stdpage('blog', <<EOF)
83 #{blog_list.join("\n")}
87 if File
.exists
? ('../resume.md')
88 stdpage('resume', md_to_html(File
.read('../resume.md')))
91 stdpage('favorite-stuff', File
.read('../favorite-stuff.html'))