premonition 4.0.0.pre3 → 4.0.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: abfe46c768bd3eb585a45c353bfec07ec3949d9e429fa6ad33048c7ea95f1073
4
- data.tar.gz: f4faec4011c684028b26ad4a6d8e4e1f898d39b430be3d52699811ae874de136
3
+ metadata.gz: c5958da36843569e59519ea1ccf58975c8604a2f087d9b0a21c2b0b85c945773
4
+ data.tar.gz: c1fb3d763996a86bc7ca3dadf0a72b2afcbeb8cfad7196c6099e9dd82dd77751
5
5
  SHA512:
6
- metadata.gz: d7e50e23298fdba22b884c1a26b1c7ccb6cc4210c0c08b20d0bb29e40e2034c60fbb253e5f1b542b6109fd82d3d878cc95e3da18887e2bb409393daf6ed2a978
7
- data.tar.gz: a419bd8dca3eadc59799eefbea6b7738a316629f45aa925c146482e202633a6685550f23fc0e15a17075f0d3bbc42ce68085786c6391333b6b420ef5df8e1cb5
6
+ metadata.gz: 92953692e95d66d1913d8a924b8db826379168e7fb2746501f1f693f8183fe00a320b29a47c3163915f88329d94ac7dde0bf14ffb760ae9c5931be54f7a157e7
7
+ data.tar.gz: ef822540e419bdc92f6a154ae388120f07289f499bb6f8e95888d3d9c44339ecfed3b5e550d4e5b1d38e89c74ed6f13e68e29084ee15cb628479c0ad950af420
data/README.md CHANGED
@@ -1,51 +1,49 @@
1
1
  # Premonition
2
2
 
3
- NOTE: This is the documentation for the version 4 release, coming soon. For 2.x documentation, please switch to the `2.x` branch.
4
-
5
3
  [Demo site](https://lazee.github.io/premonition-demo/) ([Source code](https://github.com/lazee/premonition-demo))
6
4
 
7
- Premonition is a higly customizable [Jekyll](https://jekyllrb.com/) plugin that can convert Markdown block-quotes into beautiful block styled content.
5
+ Premonition is a higly customizable [Jekyll](https://jekyllrb.com/) plugin that can convert Markdown block-quotes into beautiful block styled content.
8
6
 
9
7
  By simply adding a custom header to the first line of a [block quote](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#blockquotes), Premonition will transform it into a markup block of your choice.
10
8
 
11
9
  <p align="center">
12
- <img src="https://github.com/lazee/premonition/raw/master/screen.png" height="450"/>
10
+ <img src="https://github.com/lazee/premonition/raw/master/screen.png" height="550"/>
13
11
  </p>
14
12
 
15
13
  ## Features
16
14
 
17
- * Highly customizable (Create your own styles and templates easily)
18
- * Non-intrusive - Its just Markdown!
19
- * Easy to install
20
- * Comes with a default stylesheet (Sass/Css) and templates for beautiful messages boxes and citation.
21
- * Font Awesome 5 support
22
-
23
- ## Version 4 Highlights
24
-
25
- * Jekyll [Post Excerpts](https://jekyllrb.com/docs/posts/#post-excerpts) support
26
- * New install command for the default stylesheet.
27
- * [Kramdown reference links](https://kramdown.gettalong.org/quickref.html#links-and-images) support
28
- * Jekyll 4 support (3.7 still supported)
29
- * Added support for block attributes (See documentation further down)
30
- * Added new citation block type.
31
- * Minor fixes to the Premonition stylesheet.
32
- * Removed the need Font Awesome css in default stylesheet, but
33
- Font Awesome is still supported.
34
- * Other bug fixes. See HISTORY.md.
35
-
36
- See UPGRADE.md for help on how to upgrade from 2.x to 4.0.
37
-
15
+ - Highly customizable (Create your own styles and templates easily)
16
+ - Non-intrusive - Its just Markdown!
17
+ - Easy to install
18
+ - Comes with a default stylesheet (Sass/Css) and templates for beautiful messages boxes and citation.
19
+ - Font Awesome 5 support
20
+
21
+ ## Version 4 Highlights
22
+
23
+ - Jekyll [Post Excerpts](https://jekyllrb.com/docs/posts/#post-excerpts) support
24
+ - New install command for the default stylesheet.
25
+ - [Kramdown reference links](https://kramdown.gettalong.org/quickref.html#links-and-images) support
26
+ - Jekyll 4 support (3.7 still supported)
27
+ - Added support for block attributes (See documentation further down)
28
+ - Added new citation block type.
29
+ - Minor fixes to the Premonition stylesheet.
30
+ - Removed the need Font Awesome css in default stylesheet, but
31
+ Font Awesome is still supported.
32
+ - Other bug fixes. See HISTORY.md.
33
+
34
+ See UPGRADE.md for help on how to upgrade from 2.x to 4.0.
35
+
38
36
  ## Requirements
39
37
 
40
- * Jekyll 3.7.x or higher (We recommend the new Jekyll 4)
41
-
38
+ - Jekyll 3.7.x or higher (We recommend the new Jekyll 4)
39
+
42
40
  ## Installation
43
41
 
44
42
  Add the following line to your `Gemfile` inside your Jekyll project folder:
45
43
 
46
44
  ```
47
45
  group :jekyll_plugins do
48
- gem "premonition", "4.0.0.pre3"
46
+ gem "premonition", "4.0.0"
49
47
  end
50
48
  ```
51
49
 
@@ -53,7 +51,7 @@ Then add the the plugin to your `_config.yml`:
53
51
 
54
52
  ```yaml
55
53
  plugins:
56
- - premonition
54
+ - premonition
57
55
  ```
58
56
 
59
57
  Now make sure to download the Premonition bundle:
@@ -89,54 +87,60 @@ defined by you in `_config.yml`.
89
87
 
90
88
  The default types are:
91
89
 
92
- * note
93
- * info
94
- * warning
95
- * error
96
- * citation
90
+ - note
91
+ - info
92
+ - warning
93
+ - error
94
+ - citation
97
95
 
98
- The *Title* will normally be the block header. Leave it empty to disable
96
+ The _Title_ will normally be the block header. Leave it empty to disable
99
97
  the header.
100
98
 
101
- *attributes* are in use by the Citation type, but can be skipped for the other default types. See section about custom types for more info.
99
+ _attributes_ are in use by the Citation type, but can be skipped for the other default types. See section about custom types for more info.
102
100
 
103
101
  ### Examples
104
102
 
105
103
  Simple note with no header
106
- ~~~markdown
104
+
105
+ ```markdown
107
106
  > note ""
108
107
  > No headers in here
109
- ~~~
108
+ ```
110
109
 
111
110
  Note
112
- ~~~markdown
111
+
112
+ ```markdown
113
113
  > note "I am a not"
114
114
  > The body of the note goes here. Premonition allows you to write any `Markdown` inside the block.
115
- ~~~
115
+ ```
116
116
 
117
117
  Info
118
- ~~~markdown
118
+
119
+ ```markdown
119
120
  > info "I am some info"
120
121
  > The body of the info box goes here. Premonition allows you to write any `Markdown` inside the block.
121
- ~~~
122
+ ```
122
123
 
123
124
  Warning
124
- ~~~markdown
125
+
126
+ ```markdown
125
127
  > warning "I am a warning"
126
128
  > The body of the warning box goes here. Premonition allows you to write any `Markdown` inside the block.
127
- ~~~
129
+ ```
128
130
 
129
131
  Error
130
- ~~~markdown
132
+
133
+ ```markdown
131
134
  > error "I am an error"
132
135
  > The body of the error box goes here. Premonition allows you to write any `Markdown` inside the block.
133
- ~~~
136
+ ```
134
137
 
135
138
  Citation (Note the use of attributes here)
136
- ~~~markdown
139
+
140
+ ```markdown
137
141
  > citations "Mark Twain" [ cite = "mt" ]
138
142
  > I will be a beautiful citation quote
139
- ~~~
143
+ ```
140
144
 
141
145
  ## Configuration
142
146
 
@@ -150,12 +154,12 @@ Like Jekyll itself, Premonition uses the [Liquid Markup Language](https://github
150
154
 
151
155
  Six variables are available to the template engine:
152
156
 
153
- * *header* Boolean that tells you if a title exists and that a header should be added.
154
- * *content* The rendered content for your block.
155
- * *title* The block title.
156
- * *type* The type name (eg: note).
157
- * *meta* This is a hash that can contain any properties you would like to make available to your template. It is configured in `_config.yml`
158
- * *attrs* These are the attributes set in the block header. Like we did in the Citation example above.
157
+ - _header_ Boolean that tells you if a title exists and that a header should be added.
158
+ - _content_ The rendered content for your block.
159
+ - _title_ The block title.
160
+ - _type_ The type name (eg: note).
161
+ - _meta_ This is a hash that can contain any properties you would like to make available to your template. It is configured in `_config.yml`
162
+ - _attrs_ These are the attributes set in the block header. Like we did in the Citation example above.
159
163
 
160
164
  Take a look at our default template inside `lib/premonition/resources.rb` to
161
165
  get an idea of how this is done.
@@ -167,7 +171,7 @@ You can override the default template like this in your `_config.yml`:
167
171
  ```yaml
168
172
  premonition:
169
173
  default:
170
- template: 'Liquid template goes here'
174
+ template: "Liquid template goes here"
171
175
  ```
172
176
 
173
177
  #### Overriding the template for a default type
@@ -178,7 +182,7 @@ If you want to override the template for one of the default types (like note), d
178
182
  premonition:
179
183
  types:
180
184
  note:
181
- template: 'Liquid template goes here'
185
+ template: "Liquid template goes here"
182
186
  ```
183
187
 
184
188
  ### Adding custom types
@@ -188,24 +192,24 @@ of the defaults, or add a new one.
188
192
 
189
193
  For each type you can
190
194
 
191
- * Add a custom template (template)
192
- * Set a default title (default_title)
193
- * Set meta data that can be used inside the template
195
+ - Add a custom template (template)
196
+ - Set a default title (default_title)
197
+ - Set meta data that can be used inside the template
194
198
 
195
199
  Each type must have unique id (lowercase letters).
196
200
 
197
- ~~~yaml
201
+ ```yaml
198
202
  premonition:
199
203
  types:
200
204
  custombox:
201
205
  meta:
202
- my-meta: 'By myself'
206
+ my-meta: "By myself"
203
207
  advanced:
204
- template: 'Liquid template goes here'
205
- default_title: 'MY BLOCK'
208
+ template: "Liquid template goes here"
209
+ default_title: "MY BLOCK"
206
210
  meta:
207
- my-meta: 'By myself'
208
- ~~~
211
+ my-meta: "By myself"
212
+ ```
209
213
 
210
214
  ## More on styling
211
215
 
@@ -241,7 +245,7 @@ Then just add this to your `_config.yml`:
241
245
  premonition:
242
246
  types:
243
247
  error:
244
- fa-icon: 'fa-bug'
248
+ fa-icon: "fa-bug"
245
249
  ```
246
250
 
247
251
  Simple as that :)
@@ -46,7 +46,6 @@ module Jekyll
46
46
 
47
47
  until @buffer.eos?
48
48
  char = @buffer.getch
49
-
50
49
  case @stack.last.type
51
50
  when 0 # Outside block mode
52
51
  push_stacker(1) if char == '['
@@ -4,6 +4,9 @@ require 'net/http'
4
4
 
5
5
  module Jekyll
6
6
  module Premonition
7
+ # Public: Premonition stylesheet installer command
8
+ #
9
+ # Jekyll command that will install the Premonition stylesheet and add it to the needed resource files.
7
10
  class InstallScssCommand < Jekyll::Command
8
11
  class << self
9
12
  def init_with_program(prog)
@@ -19,45 +22,42 @@ module Jekyll
19
22
  end
20
23
 
21
24
  def process(_args, opts)
22
- begin
23
- puts '== Installing Premonition Stylesheet and resources =="'
24
- puts '-- premonition.scss --'
25
- dest = opts['dest'].nil? || opts['dest'].empty? ? './_sass/' : File.join(opts['dest'], '')
26
- main = opts['main'].nil? || opts['main'].empty? ? './assets/css/styles.scss' : opts['main']
27
- raise StandardError, "#{dest} folder does not exist. Create it manually, and run script again." unless Dir.exist?(dest)
28
- raise StandardError, "#{main} does not exist" unless File.exist?(main)
25
+ puts '== Installing Premonition Stylesheet and resources =="'
26
+ puts '-- premonition.scss --'
27
+ dest = opts['dest'].nil? || opts['dest'].empty? ? './_sass/' : File.join(opts['dest'], '')
28
+ main = opts['main'].nil? || opts['main'].empty? ? './assets/css/styles.scss' : opts['main']
29
+ raise StandardError, "#{dest} folder does not exist. Create it manually, and run script again." unless Dir.exist?(dest)
30
+ raise StandardError, "#{main} does not exist" unless File.exist?(main)
29
31
 
30
- uri = URI('https://raw.githubusercontent.com/lazee/premonition/master/stylesheet/premonition.scss')
31
- pf = "#{dest}premonition.scss"
32
+ uri = URI('https://raw.githubusercontent.com/lazee/premonition/master/stylesheet/premonition.scss')
33
+ pf = "#{dest}premonition.scss"
32
34
 
33
- if File.exist?(pf)
34
- print "You already have #{pf} installed. Continue? [Y/n]"
35
- override = gets.chomp
36
- raise StandardError, "Aborted. No harm done." if override == 'n'
37
- end
35
+ if File.exist?(pf)
36
+ print "You already have #{pf} installed. Continue? [Y/n]"
37
+ override = gets.chomp
38
+ raise StandardError, 'Aborted. No harm done.' if override == 'n'
39
+ end
38
40
 
39
- File.write(pf, Net::HTTP.get(uri))
40
- puts "Saved stylesheet in #{pf}"
41
+ File.write(pf, Net::HTTP.get(uri))
42
+ puts "Saved stylesheet in #{pf}"
41
43
 
42
- if File.readlines(main).grep(/\@import \"premonition\"/).any?
43
- puts "#{main} already imports the Premonition stylesheet."
44
+ if File.readlines(main).grep(/\@import \"premonition\"/).any?
45
+ puts "#{main} already imports the Premonition stylesheet."
46
+ else
47
+ puts 'You must add Premonition to your main SASS file.'
48
+ print "Add '@import \"premonition\";' to end of #{main} now? [Y/n] "
49
+ add = gets.chomp
50
+ if add == 'n'
51
+ puts 'Ok. But then you will need to add it manually for the styling of Premonition to work.'
44
52
  else
45
- puts 'You must add Premonition to your main SASS file.'
46
- print "Add '@import \"premonition\";' to end of #{main} now? [Y/n] "
47
- add = gets.chomp
48
- if add == 'n'
49
- puts 'Ok. But then you will need to add it manually for the styling of Premonition to work.'
50
- else
51
- f = File.open(main, 'a')
52
- f.write("\n@import \"premonition\";\n")
53
- f.close
54
- puts "Added Premonition stylesheet to #{main}."
55
- end
53
+ f = File.open(main, 'a')
54
+ f.write("\n@import \"premonition\";\n")
55
+ f.close
56
+ puts "Added Premonition stylesheet to #{main}."
56
57
  end
57
-
58
- rescue StandardError => msg
59
- puts "ERROR: #{msg}"
60
58
  end
59
+ rescue StandardError => e
60
+ puts "ERROR: #{e}"
61
61
  end
62
62
  end
63
63
  end
@@ -2,6 +2,16 @@
2
2
 
3
3
  module Jekyll
4
4
  module Premonition
5
+ # Registers Premonition hooks in Jekyll.
6
+ #
7
+ # Two hooks are added. One general hook for pages and another special
8
+ # hook for dealing with excerpts within posts.
9
+ #
10
+ # This ladder is really a hack as we scan all Markdown files and insert the
11
+ # excerpt ourselves in the document data. Unfortunately Jekyll prepares
12
+ # the excerpt way to early in the process, preventing us from hooking
13
+ # into it in a prober way. We only support excerpts if the excerpt_separator
14
+ # is explicitly set: https://jekyllrb.com/docs/posts/#post-excerpts
5
15
  class Hook < Generator
6
16
  safe true
7
17
  priority :high
@@ -10,14 +20,6 @@ module Jekyll
10
20
  super(p)
11
21
  end
12
22
 
13
- def generate_excerpt?(doc)
14
- !doc.data['excerpt_separator'].nil? && !doc.data['excerpt_separator'].empty?
15
- end
16
-
17
- def process?(resources, doc)
18
- resources.config['extensions'].include?(File.extname(doc.relative_path)[1..-1])
19
- end
20
-
21
23
  def generate(site)
22
24
  resources = Resources.new site.config
23
25
  processor = Processor.new resources
@@ -33,6 +35,16 @@ module Jekyll
33
35
  doc.content = processor.adder(doc.content) if process?(resources, doc)
34
36
  end
35
37
  end
38
+
39
+ private
40
+
41
+ def generate_excerpt?(doc)
42
+ !doc.data['excerpt_separator'].nil? && !doc.data['excerpt_separator'].empty?
43
+ end
44
+
45
+ def process?(resources, doc)
46
+ resources.config['extensions'].include?(File.extname(doc.relative_path)[1..-1])
47
+ end
36
48
  end
37
49
  end
38
50
  end
@@ -2,11 +2,18 @@
2
2
 
3
3
  module Jekyll
4
4
  module Premonition
5
+ # Class that does all of the rendering magic within Premonition.
5
6
  class Processor
6
7
  def initialize(resources)
7
8
  @resources = resources
8
9
  end
9
10
 
11
+ # Called by the registered pre_render hooks.
12
+ #
13
+ # This function takes markdown content as input and converts
14
+ # all the block quotes, with a Premonition header, into html.
15
+ #
16
+ # content - Markdown content
10
17
  def adder(content)
11
18
  o = []
12
19
  references = load_references(content)
@@ -39,6 +46,9 @@ module Jekyll
39
46
 
40
47
  private
41
48
 
49
+ # Find all the Kramdown reference name links.
50
+ # https://kramdown.gettalong.org/quickref.html#links-and-images
51
+ # https://github.com/lazee/premonition/issues/10
42
52
  def load_references(content)
43
53
  refs = ["\n"]
44
54
  content.each_line do |l|
@@ -84,6 +94,19 @@ module Jekyll
84
94
  )
85
95
  end
86
96
 
97
+ def error_template
98
+ <<~TEMPLATE
99
+ <div class="premonition error">
100
+ <div class="fa {{meta.pn-icon}}"></div>
101
+ <div class="content">
102
+ <p class="header">PREMONITION ERROR: Invalid box type</p>
103
+ You have specified an invalid box type "{{type}}". You can customize your own box types in `_config.yml`.
104
+ See documentation for more help.
105
+ </div>
106
+ </div>
107
+ TEMPLATE
108
+ end
109
+
87
110
  def create_resource(block)
88
111
  c = {
89
112
  'template' => @resources.config['default']['template'],
@@ -94,8 +117,7 @@ module Jekyll
94
117
  unless @resources.config['types'].include? block['type']
95
118
  c['title'] = ''
96
119
  c['meta'] = { 'pn-icon' => 'pn-error' }
97
- c['template'] = '<div class="premonition error"><div class="fa {{meta.pn-icon}}"></div>'\
98
- '<div class="content"><p class="header">PREMONITION ERROR: Invalid box type</p>You have specified an invalid box type "{{type}}". You can customize your own box types in `_config.yml`. See documentation for help.</div></div>'
120
+ c['template'] = error_template
99
121
  return c
100
122
  end
101
123
 
@@ -2,15 +2,18 @@
2
2
 
3
3
  module Jekyll
4
4
  module Premonition
5
+ # Class for loading the Premonition configuration and preparing it for use.
5
6
  class Resources
6
7
  attr_reader :config
7
8
  attr_reader :markdown
8
9
 
9
10
  def initialize(site_config)
10
11
  @config = load site_config
12
+ # Setup a new Markdown renderer.
11
13
  @markdown = Converters::Markdown.new site_config
12
14
  end
13
15
 
16
+ # Load the configuration of Premonition from Jekyll site configuration object.
14
17
  def load(site_config)
15
18
  cfg = default_config
16
19
  p = site_config['premonition'] || {}
@@ -24,11 +27,38 @@ module Jekyll
24
27
  cfg
25
28
  end
26
29
 
30
+ def default_template
31
+ <<~TEMPLATE
32
+ <div class="premonition {% if meta.style %}{{meta.style}} {% endif %}{{type}}">
33
+ <i class="{% if meta.fa-icon %}fas {{meta.fa-icon}}{% else %}premonition {{meta.pn-icon}}{% endif %}"></i>
34
+ <div class="content">
35
+ {% if header %}<p class="header">{{title}}</p>{% endif %}{{content}}
36
+ </div>
37
+ </div>
38
+ TEMPLATE
39
+ end
40
+
41
+ def citation_template
42
+ <<~TEMPLATE
43
+ <div class="premonition {% if meta.style %}{{meta.style}} {% endif %}{{type}}">
44
+ <i class="{% if meta.fa-icon %}fas {{meta.fa-icon}}{% else %}premonition {{meta.pn-icon}}{% endif %}"></i>
45
+ <blockquote class="content blockquote"{% if attrs.cite %} cite="{{attrs.cite}}"{% endif %}>
46
+ {{content}}
47
+ {% if header %}
48
+ <footer class="blockquote-footer">
49
+ <cite title="{{title}}">{{title}}</cite>
50
+ </footer>
51
+ {% endif %}
52
+ </blockquote>
53
+ </div>
54
+ TEMPLATE
55
+ end
56
+
57
+ # Setup the default configuration and types
27
58
  def default_config
28
59
  {
29
60
  'default' => {
30
- 'template' => '<div class="premonition {{type}}"><i class="{% if meta.fa-icon %}fas {{meta.fa-icon}}{% else %}premonition {{meta.pn-icon}}{% endif %}"></i>'\
31
- '<div class="content">{% if header %}<p class="header">{{title}}</p>{% endif %}{{content}}</div></div>',
61
+ 'template' => default_template,
32
62
  'meta' => { 'pn-icon' => 'pn-square', 'fa-icon' => nil },
33
63
  'title' => nil
34
64
  },
@@ -37,24 +67,22 @@ module Jekyll
37
67
  'info' => { 'meta' => { 'pn-icon' => 'pn-info' } },
38
68
  'warning' => { 'meta' => { 'pn-icon' => 'pn-warn' } },
39
69
  'error' => { 'meta' => { 'pn-icon' => 'pn-error' } },
40
- 'citation' => { 'meta' => { 'pn-icon' => 'pn-quote' }, 'template' =>
41
- '<div class="premonition {{type}}"><i class="{% if meta.fa-icon %}fas {{meta.fa-icon}}{% else %}premonition {{meta.pn-icon}}{% endif %}"></i>'\
42
- '<blockquote class="content blockquote"{% if attrs.cite %} cite="{{attrs.cite}}"{% endif %}>{{content}}{% if header %}'\
43
- '<footer class="blockquote-footer">'\
44
- '<cite title="{{title}}">{{title}}</cite></footer>{% endif %}</blockquote></div>' }
70
+ 'citation' => { 'meta' => { 'pn-icon' => 'pn-quote' }, 'template' => citation_template }
45
71
  },
46
- 'extensions' => [
47
- 'md',
48
- 'markdown'
72
+ 'extensions' => %w[
73
+ md
74
+ markdown
49
75
  ]
50
76
  }
51
77
  end
52
78
 
79
+ # Basic configuration validation
53
80
  def validate_defaults(df, prem)
54
81
  fail 'meta must be a hash' if !df['meta'].nil? && !df['meta'].is_a?(Hash)
55
82
  fail 'types must be a hash' if !prem['types'].nil? && !prem['types'].is_a?(Hash)
56
83
  end
57
84
 
85
+ # Load extra Premonition types configured/overriden in _config.yml
58
86
  def load_types(p, cfg)
59
87
  return if p['types'].nil?
60
88
 
@@ -65,6 +93,9 @@ module Jekyll
65
93
  end
66
94
  end
67
95
 
96
+ # Load extra extensions from config.
97
+ #
98
+ # We need this when looking for excerpts
68
99
  def load_extensions(p, cfg)
69
100
  return if p['extensions'].nil?
70
101
  return unless p['extensions'].is_a?(Array)
@@ -76,6 +107,7 @@ module Jekyll
76
107
  end
77
108
  end
78
109
 
110
+ # Validate a configured type and return as type hash
79
111
  def type_config(id, t)
80
112
  validate_type(id, t)
81
113
  {
@@ -85,6 +117,7 @@ module Jekyll
85
117
  }
86
118
  end
87
119
 
120
+ # Type validation
88
121
  def validate_type(id, t)
89
122
  fail 'id missing from type' if id.nil?
90
123
  fail "id can only be lowercase letters: #{id}" unless id[/[a-z]+/] == id
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Jekyll
4
4
  module Premonition
5
- VERSION = '4.0.0.pre3'
5
+ # Make sure to change this manually before a release.
6
+ VERSION = '4.0.0'
6
7
  end
7
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: premonition
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre3
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Vad Nielsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -106,6 +106,20 @@ dependencies:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 0.10.0
109
+ - !ruby/object:Gem::Dependency
110
+ name: test-unit
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: 3.3.5
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: 3.3.5
109
123
  - !ruby/object:Gem::Dependency
110
124
  name: turn
111
125
  requirement: !ruby/object:Gem::Requirement
@@ -155,9 +169,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
169
  version: '0'
156
170
  required_rubygems_version: !ruby/object:Gem::Requirement
157
171
  requirements:
158
- - - ">"
172
+ - - ">="
159
173
  - !ruby/object:Gem::Version
160
- version: 1.3.1
174
+ version: '0'
161
175
  requirements: []
162
176
  rubygems_version: 3.1.2
163
177
  signing_key: