jekyll-theme-endless 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +5 -0
- data/lib/jekyll-theme-endless.rb +8 -0
- data/lib/jekyll-theme-endless/generate-tagpages.rb +80 -0
- data/lib/jekyll-theme-endless/version.rb +5 -0
- metadata +5 -3
- data/_plugins/generate-tagpages.rb +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '048954cb6b01292c57d7aeddb592a94e02e71ca49ea3ff6bc17cc128e0a5dac5'
|
4
|
+
data.tar.gz: cc6597fcda7de04fd940b0904d0d542b18e9119201ccb0ddc1140080486ab456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03d0427df894a7fa5d29e4d7a2021db478c702befa0ef8e43a0786cf3f7985a522310ff518df391282b8101e57cce2d993fbdfe4b7d82d4f961746adf3aa4e68
|
7
|
+
data.tar.gz: 77afae077fa3b9d8eaee554e650c5333a682ea6aba3ee003a28992d94dfb70dcc50631f1dd7425db003b04f67d41cd34948ca2ae56c83fec92df5632b34e3c7c
|
data/README.adoc
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Generator
|
2
|
+
|
3
|
+
# Generates a page for each tag listed in `site.tags`.
|
4
|
+
# The files created are by default named `tags/<tagname>/index.html`.
|
5
|
+
# The content is generated using the layout file `_layouts/page-tag.html`
|
6
|
+
|
7
|
+
# The following values can be set in `_config.yml`
|
8
|
+
# `tag_dir`
|
9
|
+
# * the name of the directory in which the files for each tag are created;
|
10
|
+
# * default: `tags`
|
11
|
+
# `tag_title_prefix`
|
12
|
+
# * Prefix to be used for the title of the page
|
13
|
+
# * default: `Tag: `
|
14
|
+
|
15
|
+
# Necessary files:
|
16
|
+
# `_layouts/page-tag.html` - used to generate content of tag files.
|
17
|
+
|
18
|
+
# The following values are made available in the layout:
|
19
|
+
# * `page.tag` - contains the tag
|
20
|
+
# * `page.title` - contains the generated title, e.g. "Tag: <tagname>"
|
21
|
+
|
22
|
+
# NOTE: after changes to the plugin, `jekyll serve` must be started again.
|
23
|
+
|
24
|
+
# See also: https://jekyllrb.com/docs/plugins/
|
25
|
+
# See also: https://jekyllrb.com/docs/plugins/generators/
|
26
|
+
|
27
|
+
module Jekyll
|
28
|
+
|
29
|
+
module Endless
|
30
|
+
|
31
|
+
# TagPageGenerator is a subclass of Generator
|
32
|
+
class TagPageGenerator < Generator
|
33
|
+
safe true
|
34
|
+
# A Generator needs to implement the generate method
|
35
|
+
def generate(site)
|
36
|
+
# If a layout with the name `page-tag` exists
|
37
|
+
if site.layouts.key? 'page-tag'
|
38
|
+
# The directory in which the files are to be created is configured in `site.tag_dir`.
|
39
|
+
# If not, the directory `tags/` is used.
|
40
|
+
dir = site.config['tag_dir'] || 'tags'
|
41
|
+
|
42
|
+
# For each tag in the tag-list:
|
43
|
+
site.tags.each_key do |tag|
|
44
|
+
# Create a page-object using TagPage and add it to the `site.pages` array
|
45
|
+
site.pages << TagPage.new(site, site.source, File.join(dir, tag), tag)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# TagPage is a subclass of Page
|
53
|
+
# It is used in the `TagPageGenerator`
|
54
|
+
class TagPage < Page
|
55
|
+
def initialize(site, base, dir, tag)
|
56
|
+
# Define instance variables ('@') to make values available in the super-class `Page`.
|
57
|
+
# The variables are available in the layout as e.g. `page.name`.
|
58
|
+
@site = site
|
59
|
+
@base = base
|
60
|
+
@dir = dir
|
61
|
+
@name = 'index.html'
|
62
|
+
|
63
|
+
self.process(@name)
|
64
|
+
self.read_yaml(File.join(base, '_layouts'), 'page-tag.html')
|
65
|
+
|
66
|
+
# The prefix for the generated title is set via `tag_title_prefix` in `_config.yml` and defaults to `Tag: `
|
67
|
+
tag_title_prefix = site.config['tag_title_prefix'] || 'Tag: '
|
68
|
+
# Generates the title for the tag page and makes it available in the layout file as `page.title`
|
69
|
+
self.data['title'] = "#{tag_title_prefix}#{tag}"
|
70
|
+
# Makes `page.tag` available in the layout file
|
71
|
+
self.data['tag'] = tag
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-endless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Boekhoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -44,12 +44,14 @@ files:
|
|
44
44
|
- _layouts/page-tag.html
|
45
45
|
- _layouts/page.html
|
46
46
|
- _layouts/post.html
|
47
|
-
- _plugins/generate-tagpages.rb
|
48
47
|
- _sass/address.scss
|
49
48
|
- _sass/background.scss
|
50
49
|
- _sass/tag-cloud.scss
|
51
50
|
- _sass/user.scss
|
52
51
|
- assets/css/main.scss
|
52
|
+
- lib/jekyll-theme-endless.rb
|
53
|
+
- lib/jekyll-theme-endless/generate-tagpages.rb
|
54
|
+
- lib/jekyll-theme-endless/version.rb
|
53
55
|
homepage: https://gitlab.com/jekyll-theme-endless/jekyll-theme-endless.gitlab.io
|
54
56
|
licenses:
|
55
57
|
- MIT
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# Generator
|
2
|
-
|
3
|
-
# Generates a page for each tag listed in `site.tags`.
|
4
|
-
# The files created are by default named `tags/<tagname>/index.html`.
|
5
|
-
# The content is generated using the layout file `_layouts/page-tag.html`
|
6
|
-
|
7
|
-
# The following values can be set in `_config.yml`
|
8
|
-
# `tag_dir`
|
9
|
-
# * the name of the directory in which the files for each tag are created;
|
10
|
-
# * default: `tags`
|
11
|
-
# `tag_title_prefix`
|
12
|
-
# * Prefix to be used for the title of the page
|
13
|
-
# * default: `Tag: `
|
14
|
-
|
15
|
-
# Necessary files:
|
16
|
-
# `_layouts/page-tag.html` - used to generate content of tag files.
|
17
|
-
|
18
|
-
# The following values are made available in the layout:
|
19
|
-
# * `page.tag` - contains the tag
|
20
|
-
# * `page.title` - contains the generated title, e.g. "Tag: <tagname>"
|
21
|
-
|
22
|
-
# NOTE: after changes to the plugin, `jekyll serve` must be started again.
|
23
|
-
|
24
|
-
# See also: https://jekyllrb.com/docs/plugins/
|
25
|
-
# See also: https://jekyllrb.com/docs/plugins/generators/
|
26
|
-
|
27
|
-
module Jekyll
|
28
|
-
|
29
|
-
# TagPageGenerator is a subclass of Generator
|
30
|
-
class TagPageGenerator < Generator
|
31
|
-
safe true
|
32
|
-
# A Generator needs to implement the generate method
|
33
|
-
def generate(site)
|
34
|
-
# If a layout with the name `page-tag` exists
|
35
|
-
if site.layouts.key? 'page-tag'
|
36
|
-
# The directory in which the files are to be created is configured in `site.tag_dir`.
|
37
|
-
# If not, the directory `tags/` is used.
|
38
|
-
dir = site.config['tag_dir'] || 'tags'
|
39
|
-
|
40
|
-
# For each tag in the tag-list:
|
41
|
-
site.tags.each_key do |tag|
|
42
|
-
# Create a page-object using TagPage and add it to the `site.pages` array
|
43
|
-
site.pages << TagPage.new(site, site.source, File.join(dir, tag), tag)
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# TagPage is a subclass of Page
|
51
|
-
# It is used in the `TagPageGenerator`
|
52
|
-
class TagPage < Page
|
53
|
-
def initialize(site, base, dir, tag)
|
54
|
-
# Define instance variables ('@') to make values available in the super-class `Page`.
|
55
|
-
# The variables are available in the layout as e.g. `page.name`.
|
56
|
-
@site = site
|
57
|
-
@base = base
|
58
|
-
@dir = dir
|
59
|
-
@name = 'index.html'
|
60
|
-
|
61
|
-
self.process(@name)
|
62
|
-
self.read_yaml(File.join(base, '_layouts'), 'page-tag.html')
|
63
|
-
|
64
|
-
# The prefix for the generated title is set via `tag_title_prefix` in `_config.yml` and defaults to `Tag: `
|
65
|
-
tag_title_prefix = site.config['tag_title_prefix'] || 'Tag: '
|
66
|
-
# Generates the title for the tag page and makes it available in the layout file as `page.title`
|
67
|
-
self.data['title'] = "#{tag_title_prefix}#{tag}"
|
68
|
-
# Makes `page.tag` available in the layout file
|
69
|
-
self.data['tag'] = tag
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
|