jekyll-categorize-pages 0.1.9 → 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/lib/jekyll-categorize-pages.rb +7 -27
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 346da48dcb53b9d353379fa5db96993719a44e3b
|
4
|
+
data.tar.gz: 5508b873fd228d7b7d00eb4f81f3a68b33a7a9e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3219ab87dd728d63bbfe44c412d19388395a85fe3b79b6e44cd448a0bbf061e9e905f3bfc4d37ae5bb829372f41400de82d942f1cfc2c9f0babf21ec00f9bcae
|
7
|
+
data.tar.gz: febeea02f9f036d1ab8476c9512883dc8151f9f1531ef2e290a528d7f52692b68fe2f5bdf53d211bf30fbf1b4ff8c5211e7ac83daf2cf40c7b58488bf0824fa5
|
@@ -13,26 +13,21 @@ module Jekyll
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_category_and_sub_category(item, values)
|
16
|
-
|
17
|
-
|
18
|
-
item.data["category"] = values[:category]
|
19
|
-
item.data["sub_category"] = values[:sub_category]
|
16
|
+
item.data["category"] = values["category"]
|
17
|
+
item.data["sub_category"] = values["sub_category"]
|
20
18
|
end
|
21
19
|
|
22
20
|
def add_category_only(item, values)
|
23
|
-
|
24
|
-
puts "values: #{values}"
|
25
|
-
item.data["category"] = values[:category]
|
21
|
+
item.data["category"] = values["category"]
|
26
22
|
end
|
27
23
|
|
28
|
-
|
29
24
|
def isValid?(item)
|
30
25
|
all_categories = @site.data["all_categories"] || [] # sub folders inside collection
|
31
26
|
path = item.relative_path.split('/')
|
32
27
|
|
33
28
|
# if category folder has no sub categories
|
34
29
|
if path.length == 3
|
35
|
-
header_values =
|
30
|
+
header_values = { "category" => path[1] }
|
36
31
|
add_category_only(item, header_values)
|
37
32
|
return false
|
38
33
|
end
|
@@ -50,11 +45,8 @@ module Jekyll
|
|
50
45
|
|
51
46
|
def get_header_values_to_add(item)
|
52
47
|
all_categories = @site.data["all_categories"] || [] # sub folders inside collection
|
53
|
-
# puts "-----------------------"
|
54
|
-
# puts "all_categories: #{all_categories}"
|
55
|
-
# puts "item.relative_path: #{item.relative_path}"
|
56
|
-
|
57
48
|
path = item.relative_path.split('/')
|
49
|
+
puts "path: #{path}"
|
58
50
|
|
59
51
|
if path[1] != "index.html" and path[1] != "index.md"
|
60
52
|
category = path[1]
|
@@ -62,21 +54,10 @@ module Jekyll
|
|
62
54
|
if path[2] != "index.html" and path[2] != "index.md"
|
63
55
|
sub_category = path[2]
|
64
56
|
end
|
65
|
-
if path[3] != "index.html" and path[3] != "index.md"
|
66
|
-
file = path[3]
|
67
|
-
end
|
68
57
|
|
69
|
-
# category = path[1] if path[1] != "index.md"
|
70
|
-
# # puts "@category: #{@category}"
|
71
|
-
# sub_category = path[2] if path[2] != "index.md"
|
72
|
-
# # puts "@sub_category: #{@sub_category}"
|
73
|
-
# file = path[3] if path[3] != "index.md"
|
74
|
-
# # puts "file: #{file}"
|
75
|
-
|
76
58
|
return {
|
77
|
-
|
78
|
-
|
79
|
-
:file => file
|
59
|
+
"category" => category,
|
60
|
+
"sub_category" => sub_category
|
80
61
|
}
|
81
62
|
end
|
82
63
|
|
@@ -91,7 +72,6 @@ module Jekyll
|
|
91
72
|
valid_category = isValid?(item)
|
92
73
|
if valid_category
|
93
74
|
header_values = get_header_values_to_add(item)
|
94
|
-
# puts "header_values: #{header_values}"
|
95
75
|
add_category_and_sub_category(item, header_values)
|
96
76
|
end
|
97
77
|
end
|