jekyll-plugin-gkarchive 0.1.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 +7 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +12 -0
- data/README.md +1 -0
- data/Rakefile +1 -0
- data/jekyll-plugin-gkarchive.gemspec +23 -0
- data/lib/jekyll-plugin-gkarchive.rb +131 -0
- data/lib/jekyll-plugin-gkarchive/version.rb +6 -0
- data/screenshot.png +0 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3d1bacbbb23b8b6f97e6f81b5af1002490801c8bd299f4b7595a28f635aa5abf
|
4
|
+
data.tar.gz: 749975f83e40e63a283d1204fbbb44b4d27a9c6b5ca466f2bf624f73e321b2ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 69fafaa008a0b6f6b0f744584a38c5746f604641e11e1e22036d47dce5e1ae64e9389c677023bb0ade23c5fd45a5fb00cfa15ea1186b33960d0145c178fc1b43
|
7
|
+
data.tar.gz: 70d44facb44c2576fef709fe02e6a6ba53b0c996547f335bcc87ea2704c463573efb185336f1edce9b2d8a6446462e10a6cc90ea73f0789c8010ab888d3e8d14
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Copyright (c) 2018 glueckkanja.com
|
2
|
+
|
3
|
+
The above copyright notice and this permission notice shall be included in
|
4
|
+
all copies or substantial portions of the Software.
|
5
|
+
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
7
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
8
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
9
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
10
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
11
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
12
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# jekyll-plugin-gkarchive
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll-plugin-gkarchive/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-plugin-gkarchive"
|
8
|
+
spec.version = Jekyll::Archive::VERSION
|
9
|
+
spec.authors = ["@glueckkanja"]
|
10
|
+
spec.email = ["info@glueckkanja.com"]
|
11
|
+
|
12
|
+
spec.summary = "GK Jekyll Archive Page"
|
13
|
+
spec.homepage = "https://glueckkanja.com"
|
14
|
+
spec.license = "Nonstandard"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_dependency 'jekyll', '~> 3.7'
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# Title: Jekyll Archive Page // changed by GK
|
2
|
+
# Downloaded 2018-02-08 last changed DirtyF committed on Feb 01, 2018
|
3
|
+
# Original Authors: DirtyF : @DirtyF
|
4
|
+
#
|
5
|
+
# Description: Automatically generate post archives by dates, tags, and categories.
|
6
|
+
#
|
7
|
+
# Download: https://github.com/jekyll/jekyll-archives
|
8
|
+
#
|
9
|
+
# See the documentation for full configuration and usage instructions.
|
10
|
+
# frozen_string_literal: true
|
11
|
+
|
12
|
+
require "jekyll"
|
13
|
+
|
14
|
+
module Jekyll
|
15
|
+
module Archives
|
16
|
+
# Internal requires
|
17
|
+
autoload :Archive, "jekyll-plugin-gkarchive/archive"
|
18
|
+
autoload :VERSION, "jekyll-plugin-gkarchive/version"
|
19
|
+
|
20
|
+
class Archives < Jekyll::Generator
|
21
|
+
safe true
|
22
|
+
|
23
|
+
DEFAULTS = {
|
24
|
+
"layout" => "archive",
|
25
|
+
"enabled" => [],
|
26
|
+
"permalinks" => {
|
27
|
+
"year" => "/:year/",
|
28
|
+
"month" => "/:year/:month/",
|
29
|
+
"day" => "/:year/:month/:day/",
|
30
|
+
"tag" => "/tag/:name/",
|
31
|
+
"category" => "/category/:name/",
|
32
|
+
},
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
def initialize(config = nil)
|
36
|
+
@config = Utils.deep_merge_hashes(DEFAULTS, config.fetch("jekyll-archives", {}))
|
37
|
+
end
|
38
|
+
|
39
|
+
def generate(site)
|
40
|
+
@site = site
|
41
|
+
@posts = site.articles
|
42
|
+
@archives = []
|
43
|
+
|
44
|
+
@site.config["jekyll-archives"] = @config
|
45
|
+
|
46
|
+
read
|
47
|
+
@site.pages.concat(@archives)
|
48
|
+
|
49
|
+
@site.config["archives"] = @archives
|
50
|
+
end
|
51
|
+
|
52
|
+
# Read archive data from posts
|
53
|
+
def read
|
54
|
+
read_tags
|
55
|
+
read_categories
|
56
|
+
read_dates
|
57
|
+
end
|
58
|
+
|
59
|
+
def read_tags
|
60
|
+
if enabled? "tags"
|
61
|
+
tags.each do |title, posts|
|
62
|
+
@archives << Archive.new(@site, title, "tag", posts)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def read_categories
|
68
|
+
if enabled? "categories"
|
69
|
+
categories.each do |title, posts|
|
70
|
+
@archives << Archive.new(@site, title, "category", posts)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def read_dates
|
76
|
+
years.each do |year, posts|
|
77
|
+
@archives << Archive.new(@site, { :year => year }, "year", posts) if enabled? "year"
|
78
|
+
months(posts).each do |month, posts|
|
79
|
+
@archives << Archive.new(@site, { :year => year, :month => month }, "month", posts) if enabled? "month"
|
80
|
+
days(posts).each do |day, posts|
|
81
|
+
@archives << Archive.new(@site, { :year => year, :month => month, :day => day }, "day", posts) if enabled? "day"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks if archive type is enabled in config
|
88
|
+
def enabled?(archive)
|
89
|
+
@config["enabled"] == true || @config["enabled"] == "all" || if @config["enabled"].is_a? Array
|
90
|
+
@config["enabled"].include? archive
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def tags
|
95
|
+
@site.post_attr_hash("tags")
|
96
|
+
end
|
97
|
+
|
98
|
+
def categories
|
99
|
+
@site.post_attr_hash("categories")
|
100
|
+
end
|
101
|
+
|
102
|
+
# Custom `post_attr_hash` method for years
|
103
|
+
def years
|
104
|
+
hash = Hash.new { |h, key| h[key] = [] }
|
105
|
+
|
106
|
+
# In Jekyll 3, Collection#each should be called on the #docs array directly.
|
107
|
+
if Jekyll::VERSION >= "3.0.0"
|
108
|
+
@posts.docs.each { |p| hash[p.date.strftime("%Y")] << p }
|
109
|
+
else
|
110
|
+
@posts.each { |p| hash[p.date.strftime("%Y")] << p }
|
111
|
+
end
|
112
|
+
hash.each_value { |posts| posts.sort!.reverse! }
|
113
|
+
hash
|
114
|
+
end
|
115
|
+
|
116
|
+
def months(year_posts)
|
117
|
+
hash = Hash.new { |h, key| h[key] = [] }
|
118
|
+
year_posts.each { |p| hash[p.date.strftime("%m")] << p }
|
119
|
+
hash.each_value { |posts| posts.sort!.reverse! }
|
120
|
+
hash
|
121
|
+
end
|
122
|
+
|
123
|
+
def days(month_posts)
|
124
|
+
hash = Hash.new { |h, key| h[key] = [] }
|
125
|
+
month_posts.each { |p| hash[p.date.strftime("%d")] << p }
|
126
|
+
hash.each_value { |posts| posts.sort!.reverse! }
|
127
|
+
hash
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
data/screenshot.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-plugin-gkarchive
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "@glueckkanja"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- info@glueckkanja.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- Gemfile
|
63
|
+
- LICENSE.txt
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- jekyll-plugin-gkarchive.gemspec
|
67
|
+
- lib/jekyll-plugin-gkarchive.rb
|
68
|
+
- lib/jekyll-plugin-gkarchive/version.rb
|
69
|
+
- screenshot.png
|
70
|
+
homepage: https://glueckkanja.com
|
71
|
+
licenses:
|
72
|
+
- Nonstandard
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.7.2
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: GK Jekyll Archive Page
|
94
|
+
test_files: []
|