jekyll-page-boilerplate 4.2.1 → 4.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7fd37de6ea8e3b6858fa19bb1015d60513602ff83e99608c68467cf08c86775
4
- data.tar.gz: 7655f8d5b0afed1e3e86ffd2f5922f9c8ef1a433e4e1ec3c1c57f38e6704bcfd
3
+ metadata.gz: 11506899d111701050ee623e6f1970e1a6ea1028a597c47ddb09e84d2bda8625
4
+ data.tar.gz: 79a41ce8ae43e40aab6ece52faab4b0a604f462849a9bb076d8df601cff1409d
5
5
  SHA512:
6
- metadata.gz: bef77e3449efe9f265ea6255731ff8aea525fc93bba54c00445ba12dfa4c17055e00e61211184dfded8fbd946e72a10e971378f82f04b1521fcd8ad3350d88a5
7
- data.tar.gz: 476247fa459c5170f7490b1179837800a9ab0b961db857d3442da6e6a8a8ad462151ce82b3f3134b77bab4bba7225014def6af01311d8ca52538563eca9327c4
6
+ metadata.gz: 57085fc3192f461a8fbdb1bf6dfe722e5eb9447fe608b4be170922192a17c930780d4e25c253a77220ab6dcd697f94c3c2029b2c34546d7f91e0974d679e224d
7
+ data.tar.gz: 587b236f7a440a0a6d274926267b2fd9e45f83eb11724559b89a5bfba76deb27b99a809f651c96a3d7dabc78dcdce647a961e4961aea8f602aac7c006dc67a48
@@ -2,10 +2,7 @@
2
2
  module JekyllPageBoilerplate
3
3
 
4
4
  class List
5
-
6
- SPACER = '\n'
7
- REMOVE_SUFFIX = /\.\w+(?=[\s\n\r$])/
8
-
5
+
9
6
  def self.run
10
7
  Dir.glob("_boilerplates/*").map do |f|
11
8
  File.basename(f, '.*')
@@ -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 }}{{ suffix }}'
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 }}{{ suffix }}'
45
+ @config['slug'] = '{{ date }}-{{ title }}'
43
46
  else
44
- @config['slug'] = '{{ title }}{{ suffix }}'
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'] ||= @config['slug']
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
@@ -1,3 +1,3 @@
1
1
  module JekyllPageBoilerplate
2
- VERSION = "4.2.1"
2
+ VERSION = "4.3.0"
3
3
  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>` `{{title}}-{{date}}{{suffix}}`"
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.2.1
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-12 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bales