jekyll-page-boilerplate 4.2.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11506899d111701050ee623e6f1970e1a6ea1028a597c47ddb09e84d2bda8625
|
4
|
+
data.tar.gz: 79a41ce8ae43e40aab6ece52faab4b0a604f462849a9bb076d8df601cff1409d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57085fc3192f461a8fbdb1bf6dfe722e5eb9447fe608b4be170922192a17c930780d4e25c253a77220ab6dcd697f94c3c2029b2c34546d7f91e0974d679e224d
|
7
|
+
data.tar.gz: 587b236f7a440a0a6d274926267b2fd9e45f83eb11724559b89a5bfba76deb27b99a809f651c96a3d7dabc78dcdce647a961e4961aea8f602aac7c006dc67a48
|
@@ -7,7 +7,7 @@ A boilerplate is a markdown file you place under the `_boilerplates` folder to g
|
|
7
7
|
path: _posts # the path to create the new page under.
|
8
8
|
timestamp: true # when true new post/pages will include the date in the filename.
|
9
9
|
# a custom slug overrides the timestamp setting
|
10
|
-
slug: '{{ title }}-{{ date }}
|
10
|
+
slug: '{{ title }}-{{ date }}'
|
11
11
|
# slug is a template for the filename, it cant take the same tags everything else.
|
12
12
|
title: {{ boilerplate.title }} # tags like this will be replaced
|
13
13
|
layout: post # everthing else will be copied to the new post.
|
@@ -37,11 +37,14 @@ class JekyllPageBoilerplate::Page
|
|
37
37
|
@config = get_config(parsed_file['head']).merge(options)
|
38
38
|
@config['suffix'] ||= plate_path[/\.\w+$/]
|
39
39
|
@config['name'] ||= plate_path[/.*(?=\.)/] || plate_path
|
40
|
+
@config['basename'] = File.basename(plate_path, '.*')
|
41
|
+
@config['title'] ||= @config['basename']
|
42
|
+
|
40
43
|
unless @config['slug']
|
41
44
|
if @config['timestamp']
|
42
|
-
@config['slug'] = '{{ date }}-{{ title }}
|
45
|
+
@config['slug'] = '{{ date }}-{{ title }}'
|
43
46
|
else
|
44
|
-
@config['slug'] = '{{ title }}
|
47
|
+
@config['slug'] = '{{ title }}'
|
45
48
|
end
|
46
49
|
end
|
47
50
|
@head = get_head(parsed_file['head'])
|
@@ -54,8 +57,11 @@ class JekyllPageBoilerplate::Page
|
|
54
57
|
|
55
58
|
abort_unless_file_exists(@config['path'])
|
56
59
|
|
60
|
+
# puts @config['slug']
|
57
61
|
scan_slug
|
58
|
-
@config['file']
|
62
|
+
@config['file'] = @config['slug']+@config['suffix']
|
63
|
+
# puts @config['file']
|
64
|
+
# puts @config['title'].inspect
|
59
65
|
|
60
66
|
scan_template :@body
|
61
67
|
scan_template :@head
|
@@ -86,16 +92,16 @@ class JekyllPageBoilerplate::Page
|
|
86
92
|
end
|
87
93
|
|
88
94
|
def scan_slug
|
89
|
-
@config['slug'].scan(TAG_SLUG).flatten.uniq do |tag|
|
95
|
+
@config['slug'].scan(TAG_SLUG).flatten.uniq.each do |tag|
|
90
96
|
@config['slug'].gsub! /\{{2}\s{0,}#{tag}\s{0,}\}{2}/, get_tag_value(tag)
|
91
97
|
end
|
98
|
+
|
92
99
|
@config['slug'].gsub!(/[^0-9A-Za-z\.\-_]/, '-')
|
93
100
|
@config['slug'].downcase!
|
94
101
|
end
|
95
102
|
|
96
103
|
def get_tag_value(key)
|
97
|
-
return @config[key] if @config[key]
|
98
|
-
return @config['name'] if key == 'title'
|
104
|
+
return @config[key].to_s if @config[key]
|
99
105
|
key = key.split('=')
|
100
106
|
return Tag.send(key[0].to_sym, *key[1]&.split(','))
|
101
107
|
end
|
@@ -11,7 +11,7 @@ class JekyllPageBoilerplate::Application < Bales::Application
|
|
11
11
|
option :path, type: String, long_form: '--path', short_form: '-p',
|
12
12
|
description: "`<path>/title.md`"
|
13
13
|
option :slug, type: String, long_form: '--slug', short_form: '-u',
|
14
|
-
description: "`path/<slug-template
|
14
|
+
description: "`path/<slug-template>.md` `{{title}}-{{date}}`"
|
15
15
|
option :timestamp, type: TrueClass, long_form: '--timestamp', short_form: '-s',
|
16
16
|
description: "`path/<time.now>-title.md`"
|
17
17
|
option :suffix, type: String, long_form: '--suffix', short_form: '-x',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-page-boilerplate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Ferney
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bales
|