jekyll-auto-cat-plus 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-auto-cat-plus.rb +46 -47
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96482e5bba7e897bb2af450467c73be6949367c2baa1ebbc7acbb51a21e02e4f
4
- data.tar.gz: 25ace76759df9d8e1f56ad70110f51f96997c65e32df6fb524bb8bb42aacdb21
3
+ metadata.gz: ff47c161d2285fcea5af5e9d656333aa2e686dc673142e7da4adb3e253c20133
4
+ data.tar.gz: a27ecea0292ec9f1a108a0bb578a73a7275a4a18b26f43764fe47593b49343ef
5
5
  SHA512:
6
- metadata.gz: f32e01442b98ab458f0bc6bb8ec85571030ee829683414f657fa42dfef04e89801e05dab227bd0f45a38dc277f4f3b8c44b33b16ba0a7bd38ab8525bdbae0ef5
7
- data.tar.gz: 22928609dfa6f08bd2449438dc2584e1f6376d41ca464c907df3d06922d4a7d8c2052770712d4ff1e13a36cfc728dfd30570297656cbd0e69c8b420cb16a04a0
6
+ metadata.gz: ee2ebb90808271a066776134609acb6f624fa9ee21e6cceec8fa1c6e43408ada653548f76e26a700dd1c21517a13785cd94031b6ca8f7fade84357811e0546e5
7
+ data.tar.gz: 72aeedb60ef05ac74125d1c5d6d1af9805bb6b5696ecffb9c8b7a61e6204e6ff3c043d82dc08498758a0ddbd8864583a6c4134776bd034036cb0cf4546ec433c
@@ -10,57 +10,56 @@ module Jekyll
10
10
  merge_data!({ "categories" => superdirs }, :source => "file path")
11
11
  end
12
12
  end
13
- end
14
-
15
- # /_site 의 post 폴더 구조에 카테고리 페이지를 생성한다.
16
- # post 와 category_page 모두 basename 이 index.html 이므로
17
- # post를 카테고리 계층 사이에 생성하면 안된다.
18
- module SamplePlugin
19
- class CategoryPageGenerator < Jekyll::Generator
20
- def generate(site)
21
- site.categories.each do |category, posts|
22
- site.pages << CategoryPage.new(site, category, posts)
13
+ # /_site 의 post 폴더 구조에 카테고리 페이지를 생성한다.
14
+ # post 와 category_page 모두 basename 이 index.html 이므로
15
+ # post 카테고리 계층 사이에 생성하면 안된다.
16
+ module SamplePlugin
17
+ class CategoryPageGenerator < Jekyll::Generator
18
+ def generate(site)
19
+ site.categories.each do |category, posts|
20
+ site.pages << CategoryPage.new(site, category, posts)
21
+ end
23
22
  end
24
23
  end
25
- end
26
24
 
27
- # Subclass of `Jekyll::Page` with custom method definitions.
28
- class CategoryPage < Jekyll::Page
29
- def initialize(site, category, posts)
30
- @site = site # the current site instance.
31
- @base = site.source # path to the source directory.
32
-
33
- p_basename = posts.first.basename
34
- p_special_dir = posts.first.collection.relative_directory
35
- p_superdirs = posts.first.relative_path.sub(p_special_dir, "")
36
- p_superdirs = p_superdirs.sub(/#{category}.*/,"") << category
37
- @dir = p_superdirs # the directory the page will reside in.
25
+ # Subclass of `Jekyll::Page` with custom method definitions.
26
+ class CategoryPage < Jekyll::Page
27
+ def initialize(site, category, posts)
28
+ @site = site # the current site instance.
29
+ @base = site.source # path to the source directory.
30
+
31
+ p_basename = posts.first.basename
32
+ p_special_dir = posts.first.collection.relative_directory
33
+ p_superdirs = posts.first.relative_path.sub(p_special_dir, "")
34
+ p_superdirs = p_superdirs.sub(/#{category}.*/,"") << category
35
+ @dir = p_superdirs # the directory the page will reside in.
36
+
37
+ # All pages have the same filename, so define attributes straight away.
38
+ @basename = 'index' # filename without the extension.
39
+ @ext = '.html' # the extension.
40
+ @name = 'index.html' # basically @basename + @ext.
41
+
42
+ # Initialize data hash with a key pointing to all posts under current category.
43
+ # This allows accessing the list in a template via `page.linked_docs`.
44
+ @data = {
45
+ 'linked_docs' => posts
46
+ }
47
+
48
+ # Look up front matter defaults scoped to type `categories`, if given key
49
+ # doesn't exist in the `data` hash.
50
+ data.default_proc = proc do |_, key|
51
+ site.frontmatter_defaults.find(relative_path, :categories, key)
52
+ end
53
+ end
38
54
 
39
- # All pages have the same filename, so define attributes straight away.
40
- @basename = 'index' # filename without the extension.
41
- @ext = '.html' # the extension.
42
- @name = 'index.html' # basically @basename + @ext.
43
-
44
- # Initialize data hash with a key pointing to all posts under current category.
45
- # This allows accessing the list in a template via `page.linked_docs`.
46
- @data = {
47
- 'linked_docs' => posts
48
- }
49
-
50
- # Look up front matter defaults scoped to type `categories`, if given key
51
- # doesn't exist in the `data` hash.
52
- data.default_proc = proc do |_, key|
53
- site.frontmatter_defaults.find(relative_path, :categories, key)
55
+ # Placeholders that are used in constructing page URL.
56
+ def url_placeholders
57
+ {
58
+ :category => @dir,
59
+ :basename => basename,
60
+ :output_ext => output_ext,
61
+ }
54
62
  end
55
63
  end
56
-
57
- # Placeholders that are used in constructing page URL.
58
- def url_placeholders
59
- {
60
- :category => @dir,
61
- :basename => basename,
62
- :output_ext => output_ext,
63
- }
64
- end
65
64
  end
66
- end
65
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-auto-cat-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kkooing