jekyll-categorize-pages 0.1.7 → 0.1.8
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/lib/jekyll-categorize-pages.rb +28 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 206915a771e5604a0d2ed0ef6f1400c7fee20a67
|
4
|
+
data.tar.gz: 35960fb89f91c26ff1191bd2fe3e01aeed0fbb25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d39c50d73e686875113bf4dc2bdedec31768ede21bd1ce6ab9aea796ae470d79bc371d3260d2417c1044c4c0b76b83c42e26db00e167251c1c2cad8612b0b674
|
7
|
+
data.tar.gz: 816f617a9dd23e53622368960795634a544f61a9e5065cf449b10392f793043c6d6bf629e11a73a2089a322c25630801fa7fe7f090d8b9c26366fc477f593a89
|
@@ -13,18 +13,12 @@ module Jekyll
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_category_and_sub_category(item, values)
|
16
|
-
|
17
|
-
# puts "values: #{values}"
|
18
|
-
|
19
|
-
item.data["category"] = values[:category] # i.data is the front matter header
|
16
|
+
item.data["category"] = values[:category]
|
20
17
|
item.data["sub_category"] = values[:sub_category]
|
21
18
|
end
|
22
19
|
|
23
20
|
def add_category_only(item, values)
|
24
|
-
# puts "adding: #{item.relative_path}"
|
25
|
-
# puts "values: #{values}"
|
26
21
|
item.data["category"] = values[:category]
|
27
|
-
# item.data["sub_category"] = values[:sub_category].slice(0, values[:sub_category].length - 3)
|
28
22
|
end
|
29
23
|
|
30
24
|
|
@@ -32,39 +26,48 @@ module Jekyll
|
|
32
26
|
all_categories = @site.data["all_categories"] || [] # sub folders inside collection
|
33
27
|
path = item.relative_path.split('/')
|
34
28
|
|
35
|
-
category = path[1] if path[1] != "index.md"
|
36
|
-
|
37
|
-
# ignore index.md pages
|
38
|
-
if path.include?("index.md")
|
39
|
-
return false
|
40
|
-
end
|
41
|
-
|
42
29
|
# if category folder has no sub categories
|
43
30
|
if path.length == 3
|
44
|
-
# puts "path: #{path}"
|
45
|
-
# puts "length: #{path.length}"
|
46
31
|
header_values = get_header_values_to_add(item)
|
47
32
|
add_category_only(item, header_values)
|
48
33
|
return false
|
49
34
|
end
|
50
35
|
|
36
|
+
if path[1] != "index.html" and path[1] != "index.md"
|
37
|
+
category = path[1]
|
38
|
+
end
|
39
|
+
if path[2] != "index.html" and path[2] != "index.md"
|
40
|
+
sub_category = path[2]
|
41
|
+
end
|
42
|
+
|
51
43
|
return all_categories.include?(category)
|
52
44
|
end
|
53
45
|
|
54
46
|
|
55
47
|
def get_header_values_to_add(item)
|
56
48
|
all_categories = @site.data["all_categories"] || [] # sub folders inside collection
|
57
|
-
|
58
|
-
|
49
|
+
puts "-----------------------"
|
50
|
+
puts "all_categories: #{all_categories}"
|
59
51
|
# puts "item.relative_path: #{item.relative_path}"
|
60
52
|
|
61
53
|
path = item.relative_path.split('/')
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
54
|
+
|
55
|
+
if path[1] != "index.html" and path[1] != "index.md"
|
56
|
+
category = path[1]
|
57
|
+
end
|
58
|
+
if path[2] != "index.html" and path[2] != "index.md"
|
59
|
+
sub_category = path[2]
|
60
|
+
end
|
61
|
+
if path[3] != "index.html" and path[3] != "index.md"
|
62
|
+
file = path[3]
|
63
|
+
end
|
64
|
+
|
65
|
+
# category = path[1] if path[1] != "index.md"
|
66
|
+
# # puts "@category: #{@category}"
|
67
|
+
# sub_category = path[2] if path[2] != "index.md"
|
68
|
+
# # puts "@sub_category: #{@sub_category}"
|
69
|
+
# file = path[3] if path[3] != "index.md"
|
70
|
+
# # puts "file: #{file}"
|
68
71
|
|
69
72
|
return {
|
70
73
|
:category => category,
|
@@ -73,6 +76,7 @@ module Jekyll
|
|
73
76
|
}
|
74
77
|
end
|
75
78
|
|
79
|
+
# main generator init function
|
76
80
|
def generate(site)
|
77
81
|
@site = site
|
78
82
|
# The collections to add category/sub category front matter values
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-categorize-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|