zine 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +241 -0
- data/LICENSE +21 -0
- data/README.md +82 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/zine +5 -0
- data/lib/zine.rb +156 -0
- data/lib/zine/cli.rb +57 -0
- data/lib/zine/data_page.rb +23 -0
- data/lib/zine/feed.rb +44 -0
- data/lib/zine/page.rb +118 -0
- data/lib/zine/post.rb +40 -0
- data/lib/zine/server.rb +40 -0
- data/lib/zine/skeleton/source/about.md +5 -0
- data/lib/zine/skeleton/source/posts/2017-01-25-my-new-blog.md +11 -0
- data/lib/zine/skeleton/source/screen.css +1 -0
- data/lib/zine/skeleton/source/templates/default.erb +8 -0
- data/lib/zine/skeleton/source/templates/footer_partial.erb +11 -0
- data/lib/zine/skeleton/source/templates/header_partial.erb +23 -0
- data/lib/zine/skeleton/source/templates/home.erb +18 -0
- data/lib/zine/skeleton/source/templates/new_post.erb +11 -0
- data/lib/zine/skeleton/source/templates/post.erb +16 -0
- data/lib/zine/skeleton/source/templates/post_index.erb +15 -0
- data/lib/zine/skeleton/source/templates/tag.erb +15 -0
- data/lib/zine/skeleton/source/templates/tag_index.erb +15 -0
- data/lib/zine/skeleton/zine.yaml +26 -0
- data/lib/zine/tag.rb +57 -0
- data/lib/zine/templates.rb +14 -0
- data/lib/zine/version.rb +3 -0
- metadata +200 -0
@@ -0,0 +1,15 @@
|
|
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 %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= header_partial %>
|
2
|
+
<main>
|
3
|
+
<section>
|
4
|
+
<h2><%= page[:title] %></h2>
|
5
|
+
<p>Pages on this topic:</p>
|
6
|
+
<ul>
|
7
|
+
<% for @item in data %>
|
8
|
+
<li><a href="<%= page[:site_URL] %>/<%= @item[:destURL]%>"><%= @item[:pageTitle] %></a> <%= @item[:pageDateUS] %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
<p><a href="./index.html">All tags</a></p>
|
12
|
+
</div>
|
13
|
+
</section>
|
14
|
+
</main>
|
15
|
+
<%= footer_partial %>
|
@@ -0,0 +1,15 @@
|
|
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 %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
directories:
|
3
|
+
blog: blog
|
4
|
+
build: build
|
5
|
+
assets: assets
|
6
|
+
posts: posts
|
7
|
+
source: source
|
8
|
+
styles: styles
|
9
|
+
templates: templates
|
10
|
+
templates:
|
11
|
+
archive: achive.html.erb
|
12
|
+
default: static.html.erb
|
13
|
+
index: index.html.erb
|
14
|
+
new_post: new_post.md.erb
|
15
|
+
post: post.html.erb
|
16
|
+
tag: tag.html.erb
|
17
|
+
options:
|
18
|
+
css_preprocessor: less
|
19
|
+
github_name: mikekreuzer
|
20
|
+
number_items_in_RSS: 7
|
21
|
+
num_items_on_home: 7
|
22
|
+
site_author: Mike Kreuzer
|
23
|
+
site_description: The scribblings of a once and future code monkey
|
24
|
+
site_name: Mike Kreuzer
|
25
|
+
site_URL: https://mikekreuzer.com
|
26
|
+
twitter_name: mikekreuzer
|
data/lib/zine/tag.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'zine/data_page'
|
2
|
+
|
3
|
+
module Zine
|
4
|
+
# Posts' tags
|
5
|
+
class Tag
|
6
|
+
def initialize(tags_by_post, tag_templates, tag_index_templates, options)
|
7
|
+
@options = options
|
8
|
+
@posts_by_tag = sort_tags tags_by_post
|
9
|
+
@templates = { tag: tag_templates, tag_index: tag_index_templates }
|
10
|
+
@tag_dir = File.join @options['directories']['build'], 'tags'
|
11
|
+
FileUtils.mkdir_p @tag_dir
|
12
|
+
end
|
13
|
+
|
14
|
+
def write_tags
|
15
|
+
@posts_by_tag.each do |tag_name, struct_array|
|
16
|
+
sorted_array = sort_tags_by_date struct_array
|
17
|
+
data = { name: tag_name, title: 'Tags: ' + tag_name,
|
18
|
+
post_array: sorted_array, build_dir: @tag_dir }
|
19
|
+
tag_page = Zine::DataPage.new(data, @templates[:tag], @options)
|
20
|
+
tag_page.write
|
21
|
+
end
|
22
|
+
write_tag_index
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# Take an array of posts each with the tags it has, & make an array of tags,
|
28
|
+
# each with the posts it's in
|
29
|
+
def sort_tags(tags_by_post)
|
30
|
+
posts_by_tag = {}
|
31
|
+
tags_by_post.each do |post|
|
32
|
+
post['tagsArray'].each do |tag|
|
33
|
+
name = tag[:name]
|
34
|
+
if posts_by_tag.key?(name)
|
35
|
+
posts_by_tag[name] << post
|
36
|
+
else
|
37
|
+
posts_by_tag[name] = [post]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
posts_by_tag
|
42
|
+
end
|
43
|
+
|
44
|
+
def sort_tags_by_date(tag_array)
|
45
|
+
tag_array.sort_by do |post|
|
46
|
+
post[:pageDate]
|
47
|
+
end.reverse!
|
48
|
+
end
|
49
|
+
|
50
|
+
def write_tag_index
|
51
|
+
tag_index_data = { build_dir: @tag_dir, name: 'index', title: 'All tags',
|
52
|
+
post_array: @posts_by_tag.sort_by { |key, _v| key } }
|
53
|
+
tag_index = DataPage.new(tag_index_data, @templates[:tag_index], @options)
|
54
|
+
tag_index.write
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Zine
|
2
|
+
# Trio of templates used to create a page
|
3
|
+
class TemplateFiles
|
4
|
+
attr_reader :body
|
5
|
+
attr_reader :footer
|
6
|
+
attr_reader :header
|
7
|
+
|
8
|
+
def initialize(body, header, footer)
|
9
|
+
@body = body
|
10
|
+
@header = header
|
11
|
+
@footer = footer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/zine/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Kreuzer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: htmlcompressor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: kramdown
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.13'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.13'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rainbow
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.2'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thin
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.7'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.7'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.19'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.19'
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- mike@mikekreuzer.com
|
142
|
+
executables:
|
143
|
+
- zine
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- CHANGELOG.md
|
148
|
+
- LICENSE
|
149
|
+
- README.md
|
150
|
+
- bin/console
|
151
|
+
- bin/setup
|
152
|
+
- bin/zine
|
153
|
+
- lib/zine.rb
|
154
|
+
- lib/zine/cli.rb
|
155
|
+
- lib/zine/data_page.rb
|
156
|
+
- lib/zine/feed.rb
|
157
|
+
- lib/zine/page.rb
|
158
|
+
- lib/zine/post.rb
|
159
|
+
- lib/zine/server.rb
|
160
|
+
- lib/zine/skeleton/source/about.md
|
161
|
+
- lib/zine/skeleton/source/posts/2017-01-25-my-new-blog.md
|
162
|
+
- lib/zine/skeleton/source/screen.css
|
163
|
+
- lib/zine/skeleton/source/templates/default.erb
|
164
|
+
- lib/zine/skeleton/source/templates/footer_partial.erb
|
165
|
+
- lib/zine/skeleton/source/templates/header_partial.erb
|
166
|
+
- lib/zine/skeleton/source/templates/home.erb
|
167
|
+
- lib/zine/skeleton/source/templates/new_post.erb
|
168
|
+
- lib/zine/skeleton/source/templates/post.erb
|
169
|
+
- lib/zine/skeleton/source/templates/post_index.erb
|
170
|
+
- lib/zine/skeleton/source/templates/tag.erb
|
171
|
+
- lib/zine/skeleton/source/templates/tag_index.erb
|
172
|
+
- lib/zine/skeleton/zine.yaml
|
173
|
+
- lib/zine/tag.rb
|
174
|
+
- lib/zine/templates.rb
|
175
|
+
- lib/zine/version.rb
|
176
|
+
homepage: https://github.com/mikekreuzer/zine
|
177
|
+
licenses:
|
178
|
+
- MIT
|
179
|
+
metadata: {}
|
180
|
+
post_install_message:
|
181
|
+
rdoc_options: []
|
182
|
+
require_paths:
|
183
|
+
- lib
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
requirements: []
|
195
|
+
rubyforge_project:
|
196
|
+
rubygems_version: 2.6.8
|
197
|
+
signing_key:
|
198
|
+
specification_version: 4
|
199
|
+
summary: Yet another blog aware static site generator.
|
200
|
+
test_files: []
|