jekyll-page-boilerplate 4.0.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll_page_boilerplate/msg/description.md +29 -0
- data/lib/jekyll_page_boilerplate/msg.rb +11 -1
- data/lib/jekyll_page_boilerplate/page.rb +3 -8
- data/lib/jekyll_page_boilerplate/version.rb +1 -3
- data/lib/jekyll_page_boilerplate.rb +1 -1
- data/lib/jekyll_page_boilerplate_cli.rb +10 -14
- metadata +20 -5
- data/lib/jekyll_page_boilerplate/msg/readme.md +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 774edface63c05ab9dba0898408bbc7ba43936fd0d67a56fb201989bb605ae15
|
4
|
+
data.tar.gz: b1076c48762f122437d06ee5424afe489ff58b3e0ac1e2b61d134da964492b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b89128cd44e91ba760b7d7655b5c14d1d26919bca83c016364ff7dae30d91f1d63b208cb0a73a07c59abeed4c463d1dc7a2f852319992308bddc27f7073b20f2
|
7
|
+
data.tar.gz: 1dcc5e8279d8e0ad5e5cb84c5efc5209d86cccf8391d3b669f51fbc34407a508f808271992912ee158852d91b2f1a4bcf3accb2fb12270ddc999f9e25cef5a42
|
@@ -0,0 +1,29 @@
|
|
1
|
+
A boilerplate is a markdown file you place under the `_boilerplates` folder to generate new pages for jekyll.
|
2
|
+
|
3
|
+
`_boilerplates/post.md`
|
4
|
+
|
5
|
+
---
|
6
|
+
_boilerplate: # boilerplate settings
|
7
|
+
path: _posts # the path to create the new page under.
|
8
|
+
timestamp: true # when true new post/pages will include the date in the filename.
|
9
|
+
title: {{ boilerplate.title }} # tags like this will be replaced
|
10
|
+
layout: post # everthing else will be copied to the new post.
|
11
|
+
author: John Doe
|
12
|
+
|
13
|
+
|
14
|
+
`$ boilerplate post -T "Another one about pottery"` would create a new file `_posts/yyyy-mm-dd-another-one-about-pottery.markdown`
|
15
|
+
|
16
|
+
---
|
17
|
+
title: Another one about pottery
|
18
|
+
created: 'yyyy-mm-dd hh:mm:ss -0000'
|
19
|
+
layout: post
|
20
|
+
author: John Doe
|
21
|
+
|
22
|
+
|
23
|
+
Available Tags `{{ boilerplate.xxx }}`:
|
24
|
+
- `.title`, `.name`
|
25
|
+
- `.path`, `.file`, `.suffix`
|
26
|
+
- `.time`, `.date`, `.timestamp`
|
27
|
+
- `.random_url`
|
28
|
+
- Custom tags you provide in the command `bplate post custom=1`
|
29
|
+
- And anything you put under the `_boilerplate:` header
|
@@ -1,8 +1,18 @@
|
|
1
1
|
|
2
2
|
module JekyllPageBoilerplate::Msg
|
3
3
|
|
4
|
+
SUMMARY = "A jekyll plugin that allows you to create new pages or posts from a boilerplate through the terminal."
|
5
|
+
|
4
6
|
def self.file name
|
5
|
-
puts
|
7
|
+
puts self.read_file name
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.description
|
11
|
+
self.read_file('description.md')
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.read_file name
|
15
|
+
File.read(File.join(__dir__, 'msg', name))
|
6
16
|
end
|
7
17
|
|
8
18
|
def self.error(**msgs)
|
@@ -21,7 +21,7 @@ class JekyllPageBoilerplate::Page
|
|
21
21
|
|
22
22
|
def initialize boilerplate, options
|
23
23
|
options.compact!
|
24
|
-
options.transform_keys!
|
24
|
+
options.transform_keys!(&:to_s)
|
25
25
|
plate_path = get_boilerplate_path(boilerplate).to_s
|
26
26
|
|
27
27
|
abort_unless_file_exists( plate_path )
|
@@ -82,8 +82,8 @@ class JekyllPageBoilerplate::Page
|
|
82
82
|
|
83
83
|
class Tag
|
84
84
|
class << self
|
85
|
-
def
|
86
|
-
|
85
|
+
def method_missing *args
|
86
|
+
''
|
87
87
|
end
|
88
88
|
|
89
89
|
def random_url length = nil
|
@@ -93,11 +93,6 @@ class JekyllPageBoilerplate::Page
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
def fill_template key, val
|
97
|
-
@head.gsub! /\{{2}\s{0,}boilerplate\.#{key}\s{0,}\}{2}/, @config[key].to_s
|
98
|
-
@body.gsub! /\{{2}\s{0,}boilerplate\.#{key}\s{0,}\}{2}/, @config[key].to_s
|
99
|
-
end
|
100
|
-
|
101
96
|
def get_body markdown
|
102
97
|
return markdown
|
103
98
|
end
|
@@ -3,8 +3,8 @@ require 'jekyll_page_boilerplate'
|
|
3
3
|
|
4
4
|
class JekyllPageBoilerplate::Application < Bales::Application
|
5
5
|
version JekyllPageBoilerplate::VERSION
|
6
|
-
description JekyllPageBoilerplate::
|
7
|
-
|
6
|
+
description JekyllPageBoilerplate::Msg.description
|
7
|
+
summary JekyllPageBoilerplate::Msg::SUMMARY
|
8
8
|
# `boilerplate <page>`
|
9
9
|
option :title, type: String, long_form: '--title', short_form: '-T',
|
10
10
|
description: "`path/<title>.md`"
|
@@ -15,16 +15,12 @@ class JekyllPageBoilerplate::Application < Bales::Application
|
|
15
15
|
option :suffix, type: String, long_form: '--suffix', short_form: '-x',
|
16
16
|
description: "`path/title.<md, markdown, txt>`"
|
17
17
|
|
18
|
-
action do |plate, title: nil, path: nil, timestamp: nil, suffix: nil|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
description "Helpful info"
|
25
|
-
action do
|
26
|
-
JekyllPageBoilerplate.readme
|
27
|
-
end
|
18
|
+
action do |plate, *custom, title: nil, path: nil, timestamp: nil, suffix: nil|
|
19
|
+
custom = Hash[custom.map {|v| v.split('=')}]
|
20
|
+
JekyllPageBoilerplate.page plate, custom.merge({
|
21
|
+
title: title, path: path,
|
22
|
+
suffix: suffix, timestamp: timestamp
|
23
|
+
})
|
28
24
|
end
|
29
25
|
|
30
26
|
# `boilerplate help`
|
@@ -32,7 +28,7 @@ class JekyllPageBoilerplate::Application < Bales::Application
|
|
32
28
|
|
33
29
|
# `boilerplate init`
|
34
30
|
command 'init' do
|
35
|
-
|
31
|
+
summary "Creates an example boilerplate."
|
36
32
|
action do
|
37
33
|
JekyllPageBoilerplate.init
|
38
34
|
end
|
@@ -40,7 +36,7 @@ class JekyllPageBoilerplate::Application < Bales::Application
|
|
40
36
|
|
41
37
|
# `boilerplate list`
|
42
38
|
command 'list' do
|
43
|
-
|
39
|
+
summary "List all the boilerplates"
|
44
40
|
action do
|
45
41
|
JekyllPageBoilerplate.list
|
46
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Ferney
|
@@ -44,8 +44,22 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.8.5
|
47
|
-
description:
|
48
|
-
|
47
|
+
description: |+
|
48
|
+
A boilerplate is a markdown file you place under the `_boilerplates/<boilerplate>.md` folder to generate new pages for jekyll.
|
49
|
+
|
50
|
+
|
51
|
+
It can automatically timestamp and title new pages.
|
52
|
+
|
53
|
+
|
54
|
+
It will also replacing any `{{ boilerplate.xxx }}` tags with content. Available tags include `.time, .title, .date, .random_url`.
|
55
|
+
|
56
|
+
|
57
|
+
You can also provide custom tags with `boilerplate post nav_order=1` > `{{ boilerplate.nav_order }}`.
|
58
|
+
|
59
|
+
|
60
|
+
In the boilerplate header you can specify options like the path to generate pages under and if filenames should be timestamped. `_boilerplate: > path: '_posts/'`
|
61
|
+
|
62
|
+
|
49
63
|
email:
|
50
64
|
- sean@codekarma.dev
|
51
65
|
executables:
|
@@ -61,7 +75,7 @@ files:
|
|
61
75
|
- lib/jekyll_page_boilerplate/init.rb
|
62
76
|
- lib/jekyll_page_boilerplate/list.rb
|
63
77
|
- lib/jekyll_page_boilerplate/msg.rb
|
64
|
-
- lib/jekyll_page_boilerplate/msg/
|
78
|
+
- lib/jekyll_page_boilerplate/msg/description.md
|
65
79
|
- lib/jekyll_page_boilerplate/page.rb
|
66
80
|
- lib/jekyll_page_boilerplate/version.rb
|
67
81
|
- lib/jekyll_page_boilerplate_cli.rb
|
@@ -89,5 +103,6 @@ requirements: []
|
|
89
103
|
rubygems_version: 3.2.3
|
90
104
|
signing_key:
|
91
105
|
specification_version: 4
|
92
|
-
summary: A jekyll plugin that
|
106
|
+
summary: A jekyll plugin that allows you to create new pages or posts from a boilerplate
|
107
|
+
through the terminal.
|
93
108
|
test_files: []
|
@@ -1,27 +0,0 @@
|
|
1
|
-
A boilerplate is a markdown file in the `_boilerplates` folder.
|
2
|
-
|
3
|
-
ie. `_boilerplates/post.yml`
|
4
|
-
---
|
5
|
-
_boilerplate: # boilerplate settings
|
6
|
-
path: _posts # the path to create the new page under.
|
7
|
-
timestap: true # when true new post/pages will include the date in the filename.
|
8
|
-
|
9
|
-
title: {{ boilerplate.title }}
|
10
|
-
layout: post # everthing else will be copied to the new post.
|
11
|
-
author: John Doe
|
12
|
-
|
13
|
-
`$ boilerplate page post "Another one about pottery"` would create a new file `_posts/yyyy-mm-dd-another-one-about-pottery.markdown`
|
14
|
-
---
|
15
|
-
title: Another one about pottery
|
16
|
-
created: 'yyyy-mm-dd hh:mm:ss -0000'
|
17
|
-
layout: post
|
18
|
-
author: John Doe
|
19
|
-
---
|
20
|
-
|
21
|
-
Usage: `$ boilerplate [page|init|help]`
|
22
|
-
|
23
|
-
`$ boilerplate init`: creates a example boilerplate at `_boilerplates/example.md`
|
24
|
-
|
25
|
-
`$ boilerplate page <boilerplate-name> <post-title>`: Creates a new page from a boilerplate
|
26
|
-
|
27
|
-
`$ boilerplate help`: shows this dialog.
|