jekyll-archives 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-archives.rb +1 -21
- data/lib/jekyll-archives/archive.rb +6 -51
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f27192f95a4ce144e1d72588b4bf80d765357f2
|
4
|
+
data.tar.gz: 2e51316514e8d6020cfc281c302b9854e66e7c4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a07cb99f2004e548f0b386485f1f6a5ec9139b24f99db985a8a3e1b55ae42459fe07826aa5eaadc92f8454bbf5a82d3ff5c0b9891e1a0aa557190b6da5dd6a6
|
7
|
+
data.tar.gz: f46620e903c6a09d2bd7ac414162d45eaeacf7a3f95ce407b6cb4e2dabe63358bd8e9946698bff2b32b436fbaa17da34fe24ad74df8b6ce51d48b40db18749d5
|
data/lib/jekyll-archives.rb
CHANGED
@@ -45,13 +45,8 @@ module Jekyll
|
|
45
45
|
@site.config['jekyll-archives'] = @config
|
46
46
|
|
47
47
|
read
|
48
|
-
|
49
|
-
write
|
48
|
+
@site.pages.concat(@archives)
|
50
49
|
|
51
|
-
@site.keep_files ||= []
|
52
|
-
@archives.each do |archive|
|
53
|
-
@site.keep_files << archive.relative_path
|
54
|
-
end
|
55
50
|
@site.config["archives"] = @archives
|
56
51
|
end
|
57
52
|
|
@@ -97,21 +92,6 @@ module Jekyll
|
|
97
92
|
end
|
98
93
|
end
|
99
94
|
|
100
|
-
# Renders the archives into the layouts
|
101
|
-
def render
|
102
|
-
payload = @site.site_payload
|
103
|
-
@archives.each do |archive|
|
104
|
-
archive.render(@site.layouts, payload)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Write archives to their destination
|
109
|
-
def write
|
110
|
-
@archives.each do |archive|
|
111
|
-
archive.write(@site.dest)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
95
|
def tags
|
116
96
|
@site.post_attr_hash('tags')
|
117
97
|
end
|
@@ -1,15 +1,11 @@
|
|
1
1
|
module Jekyll
|
2
2
|
module Archives
|
3
|
-
class Archive
|
4
|
-
include Convertible
|
3
|
+
class Archive < Jekyll::Page
|
5
4
|
|
6
|
-
attr_accessor :posts, :type, :
|
7
|
-
attr_accessor :data, :content, :output
|
8
|
-
attr_accessor :path, :ext
|
9
|
-
attr_accessor :site
|
5
|
+
attr_accessor :posts, :type, :slug
|
10
6
|
|
11
7
|
# Attributes for Liquid templates
|
12
|
-
ATTRIBUTES_FOR_LIQUID = %w
|
8
|
+
ATTRIBUTES_FOR_LIQUID = %w(
|
13
9
|
posts
|
14
10
|
type
|
15
11
|
title
|
@@ -17,7 +13,7 @@ module Jekyll
|
|
17
13
|
name
|
18
14
|
path
|
19
15
|
url
|
20
|
-
|
16
|
+
).freeze
|
21
17
|
|
22
18
|
# Initialize a new Archive page
|
23
19
|
#
|
@@ -34,8 +30,8 @@ module Jekyll
|
|
34
30
|
@config = site.config['jekyll-archives']
|
35
31
|
|
36
32
|
# Generate slug if tag or category (taken from jekyll/jekyll/features/support/env.rb)
|
37
|
-
if title.
|
38
|
-
@slug = Utils.slugify(title)
|
33
|
+
if title.to_s.length
|
34
|
+
@slug = Utils.slugify(title.to_s)
|
39
35
|
end
|
40
36
|
|
41
37
|
# Use ".html" for file extension and url for path
|
@@ -90,31 +86,6 @@ module Jekyll
|
|
90
86
|
raise ArgumentError.new "Template \"#{template}\" provided is invalid."
|
91
87
|
end
|
92
88
|
|
93
|
-
# Add any necessary layouts to this post
|
94
|
-
#
|
95
|
-
# layouts - The Hash of {"name" => "layout"}.
|
96
|
-
# site_payload - The site payload Hash.
|
97
|
-
#
|
98
|
-
# Returns nothing.
|
99
|
-
def render(layouts, site_payload)
|
100
|
-
payload = Utils.deep_merge_hashes({
|
101
|
-
"page" => to_liquid
|
102
|
-
}, site_payload)
|
103
|
-
|
104
|
-
do_layout(payload, layouts)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Convert this Convertible's data to a Hash suitable for use by Liquid.
|
108
|
-
#
|
109
|
-
# Returns the Hash representation of this Convertible.
|
110
|
-
def to_liquid(attrs = nil)
|
111
|
-
further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map { |attribute|
|
112
|
-
[attribute, send(attribute)]
|
113
|
-
}]
|
114
|
-
|
115
|
-
Utils.deep_merge_hashes(data, further_data)
|
116
|
-
end
|
117
|
-
|
118
89
|
# Produce a title object suitable for Liquid based on type of archive.
|
119
90
|
#
|
120
91
|
# Returns a String (for tag and category archives) and nil for
|
@@ -135,17 +106,6 @@ module Jekyll
|
|
135
106
|
end
|
136
107
|
end
|
137
108
|
|
138
|
-
# Obtain destination path.
|
139
|
-
#
|
140
|
-
# dest - The String path to the destination dir.
|
141
|
-
#
|
142
|
-
# Returns the destination file path String.
|
143
|
-
def destination(dest)
|
144
|
-
path = Jekyll.sanitized_path(dest, URL.unescape_path(url))
|
145
|
-
path = File.join(path, "index.html") if url =~ /\/$/
|
146
|
-
path
|
147
|
-
end
|
148
|
-
|
149
109
|
# Obtain the write path relative to the destination directory
|
150
110
|
#
|
151
111
|
# Returns the destination relative path String.
|
@@ -159,11 +119,6 @@ module Jekyll
|
|
159
119
|
def inspect
|
160
120
|
"#<Jekyll:Archive @type=#{@type.to_s} @title=#{@title} @data=#{@data.inspect}>"
|
161
121
|
end
|
162
|
-
|
163
|
-
# Returns the Boolean of whether this Page is HTML or not.
|
164
|
-
def html?
|
165
|
-
true
|
166
|
-
end
|
167
122
|
end
|
168
123
|
end
|
169
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-archives
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alfred Xing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.5.1
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Post archives for Jekyll.
|