zine 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -1
- data/lib/zine.rb +48 -33
- data/lib/zine/cli.rb +2 -1
- data/lib/zine/data_page.rb +2 -2
- data/lib/zine/page.rb +6 -4
- data/lib/zine/skeleton/source/screen.css +1 -1
- data/lib/zine/skeleton/source/templates/articles.erb +12 -0
- data/lib/zine/skeleton/source/templates/header_partial.erb +4 -0
- data/lib/zine/skeleton/source/templates/rss.erb +21 -0
- data/lib/zine/skeleton/zine.yaml +8 -6
- data/lib/zine/version.rb +1 -1
- metadata +9 -7
- data/lib/zine/feed.rb +0 -44
- data/lib/zine/skeleton/source/templates/post_index.erb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ce608b8b5c136ee23895b7ee2771cc091a4a87a
|
4
|
+
data.tar.gz: ca955519ffe65010a7029f3f0d43f26bdeecee19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39009e82432ea5260a0f1178b87c2e92dc0f8bbbd8e09051d877d1e89f83e8a8752607d700d39c3000f0fc0a5ec09b05549575977e78c0929c181c062076a9ad
|
7
|
+
data.tar.gz: afaa3801a74fca91ed7d743f219c75776948aa1877e0df57aa26913941292cdd7b92764770cf2d91793f3e542e165e0f41d9a4f71e4e3bfe6b462da4bcfd4413
|
data/CHANGELOG.md
CHANGED
@@ -223,6 +223,8 @@ Two weeks to get the rough structure right, and to get something like a minimum
|
|
223
223
|
|
224
224
|
1. [Tweet](https://twitter.com/mikekreuzer/status/828231071770632193)
|
225
225
|
|
226
|
+
## v0.1.0
|
227
|
+
|
226
228
|
### Day 14: February 6, 2017
|
227
229
|
|
228
230
|
**Today's Progress**:
|
@@ -238,4 +240,61 @@ Two weeks, and here's the first cut of code to GitHub & a (slightly) more than j
|
|
238
240
|
|
239
241
|
**Links to work**
|
240
242
|
|
241
|
-
|
243
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
244
|
+
2. [Gem](https://rubygems.org/gems/zine)
|
245
|
+
3. [Tweet](https://twitter.com/mikekreuzer/status/828584150479228928)
|
246
|
+
|
247
|
+
### Day 15: February 7, 2017
|
248
|
+
|
249
|
+
**Today's Progress**:
|
250
|
+
|
251
|
+
- RSS now using DataPage & ERB, with CDATA tags
|
252
|
+
- added Ruby 2.0 as a minimum to the gemspec
|
253
|
+
- version headings added to this log
|
254
|
+
|
255
|
+
**Thoughts:**
|
256
|
+
|
257
|
+
My thoughts are in the blog post. Happy. :-)
|
258
|
+
|
259
|
+
**Links to work**
|
260
|
+
|
261
|
+
1. [Blog post](https://mikekreuzer.com/blog/2017/2/two-weeks-of-code.html)
|
262
|
+
2. [Repo](https://github.com/mikekreuzer/zine)
|
263
|
+
3. [Tweet](https://twitter.com/mikekreuzer/status/828952725090037760)
|
264
|
+
|
265
|
+
### Day 16: February 8, 2017
|
266
|
+
|
267
|
+
**Today's Progress**:
|
268
|
+
|
269
|
+
- template names from zine.yaml
|
270
|
+
|
271
|
+
**Thoughts:**
|
272
|
+
|
273
|
+
A stocktake sort of a day. Need to get some changes back into the templates, then do the articles index. May consolidate the DataPage calls, & maybe get posts out of Site at the same time.
|
274
|
+
|
275
|
+
**Links to work**
|
276
|
+
|
277
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
278
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/829318150868983808)
|
279
|
+
|
280
|
+
## v0.2.0
|
281
|
+
|
282
|
+
### Day 17: February 9, 2017
|
283
|
+
|
284
|
+
**Today's Progress**:
|
285
|
+
|
286
|
+
- consolidated the DataPage calls in the Site class (the home page, feed, and now added an articles/archive index to that)
|
287
|
+
- added 'skip to main content' back into the header partial
|
288
|
+
- some bug fixes & minor refactoring
|
289
|
+
- version 0.2.0
|
290
|
+
|
291
|
+
**Thoughts:**
|
292
|
+
|
293
|
+
Played around with the concurrent-ruby gem - seems promising, inspired by Erlang it's got a lot in common with Elixir... but it doesn't work to just fling the local server into the background with async, & Thin itself uses EventMachine...
|
294
|
+
|
295
|
+
Was listening in on RubyConf_au going on in the background on Twitter all day -- inspirational. Couldn't wait to start my hour of coding, even more than usual. :-)
|
296
|
+
|
297
|
+
**Links to work**
|
298
|
+
|
299
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
300
|
+
2. [Gem](https://rubygems.org/gems/zine)
|
data/lib/zine.rb
CHANGED
@@ -2,7 +2,6 @@ require 'erb'
|
|
2
2
|
require 'rainbow'
|
3
3
|
require 'zine/data_page'
|
4
4
|
require 'zine/page'
|
5
|
-
require 'zine/feed'
|
6
5
|
require 'zine/post'
|
7
6
|
require 'zine/server'
|
8
7
|
require 'zine/tag'
|
@@ -41,37 +40,33 @@ module Zine
|
|
41
40
|
def build_site
|
42
41
|
read_post_markdown_files
|
43
42
|
sort_posts_by_date
|
44
|
-
|
43
|
+
write_posts_and_headlines
|
45
44
|
housekeeping_copy
|
46
45
|
write_other_markdown_pages
|
47
|
-
write_feed
|
48
46
|
preview
|
49
47
|
end
|
50
48
|
|
51
49
|
def clean_option_paths
|
50
|
+
directories = @options['directories']
|
52
51
|
%w(assets posts styles templates).each do |dir|
|
53
|
-
|
54
|
-
File.join @options['directories']['source'],
|
55
|
-
@options['directories'][dir]
|
52
|
+
directories[dir] = File.join directories['source'], directories[dir]
|
56
53
|
end
|
57
|
-
|
58
|
-
File.join @options['directories']['build'],
|
59
|
-
@options['directories']['blog']
|
54
|
+
directories['blog'] = File.join directories['build'], directories['blog']
|
60
55
|
end
|
61
56
|
|
62
57
|
def housekeeping_copy
|
63
|
-
|
58
|
+
directories = @options['directories']
|
59
|
+
src_dir = directories['source']
|
64
60
|
search = File.join src_dir, '**', '*.*'
|
65
|
-
dir_options = @options['directories']
|
66
61
|
possible = Dir.glob(search, File::FNM_DOTMATCH).reject do |found|
|
67
62
|
found =~ /^.+\.md$|^.+\.erb$|^\.DS_Store$|^\.$|^\.\.$'/ ||
|
68
|
-
File.directory?(found) || found[
|
69
|
-
found[
|
63
|
+
File.directory?(found) || found[directories['posts']] ||
|
64
|
+
found[directories['templates']]
|
70
65
|
end
|
71
66
|
possible.each do |file|
|
72
67
|
dir = Pathname(File.dirname(file)).relative_path_from(Pathname(src_dir))
|
73
68
|
filename = File.basename file
|
74
|
-
dest = File.join
|
69
|
+
dest = File.join directories['build'], dir
|
75
70
|
FileUtils.mkdir_p dest
|
76
71
|
FileUtils.cp file, File.join(dest, filename)
|
77
72
|
end
|
@@ -95,9 +90,10 @@ module Zine
|
|
95
90
|
|
96
91
|
def read_post_markdown_files
|
97
92
|
file_name_array = Dir[File.join(@options['directories']['posts'], '*.md')]
|
93
|
+
post_name = @options['templates']['post']
|
98
94
|
file_name_array.each do |file|
|
99
95
|
@post_array << Zine::Post.new(file,
|
100
|
-
make_template_bundle(
|
96
|
+
make_template_bundle(post_name),
|
101
97
|
@options)
|
102
98
|
end
|
103
99
|
end
|
@@ -109,48 +105,67 @@ module Zine
|
|
109
105
|
@post_array.freeze
|
110
106
|
end
|
111
107
|
|
112
|
-
def
|
113
|
-
|
114
|
-
|
115
|
-
|
108
|
+
def headline_pages
|
109
|
+
dir = @options['directories']['build']
|
110
|
+
options = @options['options']
|
111
|
+
templates = @options['templates']
|
112
|
+
[{ build_dir: dir, name: 'articles', number: @post_array.size,
|
113
|
+
suffix: '.html', template_name: templates['articles'],
|
114
|
+
title: 'Articles' },
|
115
|
+
{ build_dir: dir, name: 'index',
|
116
|
+
number: options['num_items_on_home'], suffix: '.html',
|
117
|
+
template_name: templates['home'], title: 'Home' },
|
118
|
+
{ build_dir: dir, name: 'rss',
|
119
|
+
number: options['number_items_in_RSS'], suffix: '.xml',
|
120
|
+
template_name: templates['rss'], title: '' }]
|
121
|
+
end
|
122
|
+
|
123
|
+
def wrangle_headlines
|
124
|
+
headline_pages.each do |page|
|
125
|
+
write_headline page
|
126
|
+
end
|
116
127
|
end
|
117
128
|
|
118
|
-
def
|
119
|
-
|
120
|
-
|
121
|
-
@post_array.first(
|
122
|
-
|
123
|
-
|
129
|
+
def write_headline(page)
|
130
|
+
data = page
|
131
|
+
data[:post_array] = []
|
132
|
+
@post_array.first(page[:number]).each do |post|
|
133
|
+
post_data = post.formatted_data
|
134
|
+
data[:post_array] << { page: post_data.page, html: post_data.html,
|
135
|
+
uri: post_data.uri }
|
124
136
|
end
|
125
|
-
|
126
|
-
@options)
|
127
|
-
|
137
|
+
data_page = DataPage.new(data, make_template_bundle(data[:template_name]),
|
138
|
+
@options, data[:suffix])
|
139
|
+
data_page.write
|
128
140
|
end
|
129
141
|
|
130
142
|
def write_other_markdown_pages
|
131
143
|
dir_options = @options['directories']
|
132
144
|
src_dir = dir_options['source']
|
133
145
|
search = File.join src_dir, '**', '*.md'
|
146
|
+
default_name = @options['templates']['default']
|
134
147
|
Dir[search].reject { |found| found[dir_options['posts']] }.each do |file|
|
135
148
|
dir = Pathname(File.dirname(file)).relative_path_from(Pathname(src_dir))
|
136
149
|
file_name = "#{File.basename(file, '.*')}.html"
|
137
150
|
dest = File.join dir_options['build'], dir
|
138
151
|
FileUtils.mkdir_p dest
|
139
152
|
page = Zine::Page.new(file, File.join(dest, file_name),
|
140
|
-
make_template_bundle(
|
153
|
+
make_template_bundle(default_name), @options)
|
141
154
|
page.process
|
142
155
|
end
|
143
156
|
end
|
144
157
|
|
145
|
-
def
|
158
|
+
def write_posts_and_headlines
|
146
159
|
tags_by_post = []
|
147
160
|
@post_array.each do |post|
|
148
161
|
tags_by_post << post.process
|
149
162
|
end
|
150
|
-
|
151
|
-
|
163
|
+
tag_name = @options['templates']['tag']
|
164
|
+
tag_index_name = @options['templates']['tag_index']
|
165
|
+
tags = Zine::Tag.new tags_by_post, make_template_bundle(tag_name),
|
166
|
+
make_template_bundle(tag_index_name), @options
|
152
167
|
tags.write_tags
|
153
|
-
|
168
|
+
wrangle_headlines
|
154
169
|
end
|
155
170
|
end
|
156
171
|
end
|
data/lib/zine/cli.rb
CHANGED
@@ -38,7 +38,8 @@ module Zine
|
|
38
38
|
@date = DateTime.now
|
39
39
|
@name = name
|
40
40
|
file = "#{@date.strftime('%Y-%m-%d')}-#{Zine::Page.slug(name)}.md"
|
41
|
-
|
41
|
+
new_post_name = @site.options['templates']['new_post']
|
42
|
+
template new_post_name,
|
42
43
|
File.join(Dir.pwd, option_dir['posts'], file)
|
43
44
|
end
|
44
45
|
|
data/lib/zine/data_page.rb
CHANGED
@@ -4,13 +4,13 @@ module Zine
|
|
4
4
|
# A page where the content comes from an array, usually an array of
|
5
5
|
# links to other pages, eg an index page like the home page
|
6
6
|
class DataPage < Zine::Page
|
7
|
-
def initialize(data, templates, site_options)
|
7
|
+
def initialize(data, templates, site_options, suffix = '.html')
|
8
8
|
init_templates(templates)
|
9
9
|
@formatted_data = FormattedData.new({}, site_options)
|
10
10
|
@formatted_data.page[:title] = data[:title]
|
11
11
|
@formatted_data.data = data[:post_array]
|
12
12
|
@dest_path = File.join(data[:build_dir],
|
13
|
-
Zine::Page.slug(data[:name]) +
|
13
|
+
Zine::Page.slug(data[:name]) + suffix)
|
14
14
|
write
|
15
15
|
end
|
16
16
|
|
data/lib/zine/page.rb
CHANGED
@@ -15,11 +15,13 @@ module Zine
|
|
15
15
|
attr_reader :formatted_data
|
16
16
|
# the meta data, passed formatted to the template
|
17
17
|
class FormattedData
|
18
|
+
include ERB::Util
|
19
|
+
|
18
20
|
attr_accessor :data
|
19
21
|
attr_accessor :footer_partial
|
20
22
|
attr_accessor :header_partial
|
21
23
|
attr_accessor :html
|
22
|
-
attr_reader
|
24
|
+
attr_reader :page
|
23
25
|
attr_accessor :uri
|
24
26
|
|
25
27
|
def initialize(front_matter, site_opt)
|
@@ -32,12 +34,12 @@ module Zine
|
|
32
34
|
site_name: site_opt['options']['site_name'],
|
33
35
|
site_URL: site_opt['options']['site_URL'],
|
34
36
|
tags: slugify_tags(front_matter['tags']),
|
35
|
-
title: front_matter['title'],
|
37
|
+
title: html_escape(front_matter['title']),
|
36
38
|
twitter_name: site_opt['options']['twitter_name'] }
|
37
39
|
end
|
38
40
|
|
39
|
-
def parse_date(
|
40
|
-
DateTime.rfc3339(
|
41
|
+
def parse_date(front_matter_date)
|
42
|
+
DateTime.rfc3339(front_matter_date).strftime('%B %-d, %Y')
|
41
43
|
rescue
|
42
44
|
''
|
43
45
|
end
|
@@ -1 +1 @@
|
|
1
|
-
*{margin:0;padding:0}html,body{height:100%}body{background-color:#fff;font-family:GillSansRegular,'Gill Sans MT','Gill Sans','Century Gothic',Calibri,'Trebuchet MS',sans-serif;line-height:1.618;color:#333;text-align:center;font-weight:300}h1,h2,h3,h4,h5,h6{color:#333;letter-spacing:.1em}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:#414f7c;text-decoration:none}h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color:#212721}h1{font-weight:300;font-size:2.618em;margin:1.809em 0 .809em}h2{font-weight:300;font-size:1.618em;margin:1.809em 0 .809em}h3,h4,h5,h6{font-weight:400;font-size:1em;margin:1.809em 0 .809em}p{margin:1em 0}a{color:#414f7c}a:hover{color:#212721}section{margin-bottom:1.618em}section>section{margin-bottom:3.236em}body>header{width:43em;text-align:center;margin:0 auto 0}body>header a{text-decoration:none;margin-left:.5em;margin-right:.5em}body>header,body>main,body>footer{display:block}body>header a{color:#414f7c}body>header a:hover{color:#212721}body>header a.extra{color:#414f7c;margin-left:1em}body>header a.extra:hover{color:#212721}body>header nav ul li{display:inline;list-style:none}.button{width:30px;height:30px;display:inline-block;background-size:100%;text-indent:-999em;text-align:left;margin:20px}.twitter{background:url('/assets/webicon-twitter-m.png');background-image:url('/assets/webicon-twitter.svg'),none}.rss{background:url('/assets/webicon-rss-m.png');background-image:url('/assets/webicon-rss.svg'),none}main{text-align:left;width:43em;margin:3em auto 2em}main li{margin-left:2.618em}.meta{color:#667}footer{width:43em;color:#667;border-top:4px solid #ddd;margin:3em auto 2em;overflow:hidden}footer .contact{float:left;margin-right:3em}footer .contact a,.tags a{color:#414f7c;text-decoration:none}footer .contact a:hover,.tags a:hover{color:#212721;text-decoration:none}.tags ul li{list-style:none;display:inline;font-variant:small-caps;font-size:1.2em}.archive a{text-decoration:none}ul.archive,ul.archive ul{margin-left:0}ul.archive li,ul.archive ul li{list-style:none;margin-left:0}.post pre{border:1px solid #ddd;background-color:#fff;padding:0 .4em}p.date{color:#667}pre{background-color:#eee;padding:1em;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}code{font-family:Consolas,Menlo,Monaco,'Lucida Console','Courier New',monospace,serif;font-size:.8em}blockquote{margin:2em 2em 2em 1em;padding:0 .75em 0 1.25em;border-left:2px solid #ddd;border-right:0 solid #ddd}@media all and (max-width:736px){body>header,main,footer{width:86%;margin:0 auto 0;padding:12px 24px 12px}p{margin-bottom:2em}.button{width:50px;height:50px;margin:20px}}
|
1
|
+
*{margin:0;padding:0}html,body{height:100%}body{background-color:#fff;font-family:GillSansRegular,'Gill Sans MT','Gill Sans','Century Gothic',Calibri,'Trebuchet MS',sans-serif;line-height:1.618;color:#333;text-align:center;font-weight:300}#skiptocontent{height:1px;width:1px;position:absolute;overflow:hidden;top:-10px}h1,h2,h3,h4,h5,h6{color:#333;letter-spacing:.1em}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:#414f7c;text-decoration:none}h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color:#212721}h1{font-weight:300;font-size:2.618em;margin:1.809em 0 .809em}h2{font-weight:300;font-size:1.618em;margin:1.809em 0 .809em}h3,h4,h5,h6{font-weight:400;font-size:1em;margin:1.809em 0 .809em}p{margin:1em 0}a{color:#414f7c}a:hover{color:#212721}section{margin-bottom:1.618em}section>section{margin-bottom:3.236em}body>header{width:43em;text-align:center;margin:0 auto 0}body>header a{text-decoration:none;margin-left:.5em;margin-right:.5em}body>header,body>main,body>footer{display:block}body>header a{color:#414f7c}body>header a:hover{color:#212721}body>header a.extra{color:#414f7c;margin-left:1em}body>header a.extra:hover{color:#212721}body>header nav ul li{display:inline;list-style:none}.button{width:30px;height:30px;display:inline-block;background-size:100%;text-indent:-999em;text-align:left;margin:20px}.twitter{background:url('/assets/webicon-twitter-m.png');background-image:url('/assets/webicon-twitter.svg'),none}.rss{background:url('/assets/webicon-rss-m.png');background-image:url('/assets/webicon-rss.svg'),none}main{text-align:left;width:43em;margin:3em auto 2em}main li{margin-left:2.618em}.meta{color:#667}footer{width:43em;color:#667;border-top:4px solid #ddd;margin:3em auto 2em;overflow:hidden}footer .contact{float:left;margin-right:3em}footer .contact a,.tags a{color:#414f7c;text-decoration:none}footer .contact a:hover,.tags a:hover{color:#212721;text-decoration:none}.tags ul li{list-style:none;display:inline;font-variant:small-caps;font-size:1.2em}.archive a{text-decoration:none}ul.archive,ul.archive ul{margin-left:0}ul.archive li,ul.archive ul li{list-style:none;margin-left:0}.post pre{border:1px solid #ddd;background-color:#fff;padding:0 .4em}p.date{color:#667}pre{background-color:#eee;padding:1em;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}code{font-family:Consolas,Menlo,Monaco,'Lucida Console','Courier New',monospace,serif;font-size:.8em}blockquote{margin:2em 2em 2em 1em;padding:0 .75em 0 1.25em;border-left:2px solid #ddd;border-right:0 solid #ddd}@media all and (max-width:736px){body>header,main,footer{width:86%;margin:0 auto 0;padding:12px 24px 12px}p{margin-bottom:2em}.button{width:50px;height:50px;margin:20px}}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= header_partial %>
|
2
|
+
<main>
|
3
|
+
<section>
|
4
|
+
<h2>Previously...</h2>
|
5
|
+
<ul>
|
6
|
+
<% for @post in data %>
|
7
|
+
<li><p><a href="<%= @post[:uri] %>"><%= @post[:page][:title] %></a> — <%= @post[:page][:date_us] %></p></li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
</section>
|
11
|
+
</main>
|
12
|
+
<%= footer_partial %>
|
@@ -10,6 +10,9 @@
|
|
10
10
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
|
+
<div id="skiptocontent">
|
14
|
+
<a href="#maincontent">Skip to main content</a>
|
15
|
+
</div>
|
13
16
|
<header>
|
14
17
|
<div class="logo"></div>
|
15
18
|
<h1><a href="<%= page[:site_URL] %>"><%= page[:site_name] %></a></h1>
|
@@ -21,3 +24,4 @@
|
|
21
24
|
</ul><a href="https://twitter.com/<%= page[:twitter_name] %>" class="button twitter">Argue with me on Twitter</a><a href="<%= page[:site_URL] %>/rss.xml" rel="home" type="application/rss+xml" class="button rss">RSS Feed</a>
|
22
25
|
</nav>
|
23
26
|
</header>
|
27
|
+
<a name="maincontent"></a>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom"
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
4
|
+
<author>
|
5
|
+
<name><%= page[:site_author] %></name>
|
6
|
+
</author>
|
7
|
+
<id><%= page[:site_URL] %>/rss.xml</id>
|
8
|
+
<title><%= page[:site_name] %></title>
|
9
|
+
<dc:date><%= data[0][:page][:date_rfc3339] %></dc:date>
|
10
|
+
<updated><%= data[0][:page][:date_rfc3339] %></updated>
|
11
|
+
<% for @post in data %>
|
12
|
+
<entry>
|
13
|
+
<content type="html"><![CDATA[<%= @post[:html] %>]]></content>
|
14
|
+
<id><%= @post[:uri] %></id>
|
15
|
+
<link href="<%= @post[:uri] %>"/>
|
16
|
+
<title><%= @post[:page][:title] %></title>
|
17
|
+
<updated><%= @post[:page][:date_rfc3339] %></updated>
|
18
|
+
<dc:date><%= @post[:page][:date_rfc3339] %></dc:date>
|
19
|
+
</entry>
|
20
|
+
<% end %>
|
21
|
+
</feed>
|
data/lib/zine/skeleton/zine.yaml
CHANGED
@@ -8,12 +8,14 @@ directories:
|
|
8
8
|
styles: styles
|
9
9
|
templates: templates
|
10
10
|
templates:
|
11
|
-
|
12
|
-
default:
|
13
|
-
|
14
|
-
new_post: new_post.
|
15
|
-
post: post
|
16
|
-
|
11
|
+
articles: articles
|
12
|
+
default: default
|
13
|
+
home: home
|
14
|
+
new_post: new_post.erb
|
15
|
+
post: post
|
16
|
+
rss: rss
|
17
|
+
tag: tag
|
18
|
+
tag_index: tag_index
|
17
19
|
options:
|
18
20
|
css_preprocessor: less
|
19
21
|
github_name: mikekreuzer
|
data/lib/zine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kreuzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,7 +136,9 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.19'
|
139
|
-
description:
|
139
|
+
description: |-
|
140
|
+
Yet another blog aware static site generator.
|
141
|
+
These are the very early days of zine, expect breaking changes.
|
140
142
|
email:
|
141
143
|
- mike@mikekreuzer.com
|
142
144
|
executables:
|
@@ -153,20 +155,20 @@ files:
|
|
153
155
|
- lib/zine.rb
|
154
156
|
- lib/zine/cli.rb
|
155
157
|
- lib/zine/data_page.rb
|
156
|
-
- lib/zine/feed.rb
|
157
158
|
- lib/zine/page.rb
|
158
159
|
- lib/zine/post.rb
|
159
160
|
- lib/zine/server.rb
|
160
161
|
- lib/zine/skeleton/source/about.md
|
161
162
|
- lib/zine/skeleton/source/posts/2017-01-25-my-new-blog.md
|
162
163
|
- lib/zine/skeleton/source/screen.css
|
164
|
+
- lib/zine/skeleton/source/templates/articles.erb
|
163
165
|
- lib/zine/skeleton/source/templates/default.erb
|
164
166
|
- lib/zine/skeleton/source/templates/footer_partial.erb
|
165
167
|
- lib/zine/skeleton/source/templates/header_partial.erb
|
166
168
|
- lib/zine/skeleton/source/templates/home.erb
|
167
169
|
- lib/zine/skeleton/source/templates/new_post.erb
|
168
170
|
- lib/zine/skeleton/source/templates/post.erb
|
169
|
-
- lib/zine/skeleton/source/templates/
|
171
|
+
- lib/zine/skeleton/source/templates/rss.erb
|
170
172
|
- lib/zine/skeleton/source/templates/tag.erb
|
171
173
|
- lib/zine/skeleton/source/templates/tag_index.erb
|
172
174
|
- lib/zine/skeleton/zine.yaml
|
@@ -185,7 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
187
|
requirements:
|
186
188
|
- - ">="
|
187
189
|
- !ruby/object:Gem::Version
|
188
|
-
version: '0'
|
190
|
+
version: '2.0'
|
189
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
192
|
requirements:
|
191
193
|
- - ">="
|
@@ -193,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
195
|
version: '0'
|
194
196
|
requirements: []
|
195
197
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.6.
|
198
|
+
rubygems_version: 2.6.10
|
197
199
|
signing_key:
|
198
200
|
specification_version: 4
|
199
201
|
summary: Yet another blog aware static site generator.
|
data/lib/zine/feed.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rss'
|
2
|
-
require 'uri'
|
3
|
-
# require 'zine/page'
|
4
|
-
|
5
|
-
module Zine # < Zine::Page
|
6
|
-
# produce the RSS/Atom feed for the site
|
7
|
-
class Feed
|
8
|
-
def initialize(post_array, options)
|
9
|
-
@post_array = post_array
|
10
|
-
@options = options['options']
|
11
|
-
@rss = create_rss
|
12
|
-
@dest_path = File.join(options['directories']['build'], 'rss.xml')
|
13
|
-
end
|
14
|
-
|
15
|
-
def create_rss
|
16
|
-
RSS::Maker.make('atom') do |maker|
|
17
|
-
maker.channel.author = @options['site_author']
|
18
|
-
maker.channel.updated = @post_array[0].formatted_data
|
19
|
-
.page[:date_rfc3339].to_s
|
20
|
-
maker.channel.about = (URI.join @options['site_URL'], 'rss.xml').to_s
|
21
|
-
maker.channel.title = @options['site_name']
|
22
|
-
|
23
|
-
@post_array.each do |post|
|
24
|
-
maker.items.new_item do |item|
|
25
|
-
data = post.formatted_data
|
26
|
-
meta = data.page
|
27
|
-
item.link = data.uri
|
28
|
-
item.title = meta[:title]
|
29
|
-
item.updated = meta[:date_rfc3339].to_s
|
30
|
-
# item.content.content = data.html
|
31
|
-
# item.content.type = 'html'
|
32
|
-
# =><content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
33
|
-
item.content.type = 'xhtml'
|
34
|
-
item.content.xml_content = data.html
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end # rss
|
38
|
-
end # fn
|
39
|
-
|
40
|
-
def process
|
41
|
-
File.write(@dest_path, @rss)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<%= header_partial %>
|
2
|
-
<main>
|
3
|
-
<section>
|
4
|
-
<h2><%= page[:title] %></h2>
|
5
|
-
<% for @name, @tag in data %>
|
6
|
-
<h3><%= @name %></h3>
|
7
|
-
<ul>
|
8
|
-
<% for @post in @tag %>
|
9
|
-
<li><a href="<%= @post[:destURL] %>"><%= @post[:pageTitle] %></a> <%= @post[:pageDateUS] %></li>
|
10
|
-
<% end %>
|
11
|
-
</ul>
|
12
|
-
<% end %>
|
13
|
-
</section>
|
14
|
-
</main>
|
15
|
-
<%= footer_partial %>
|