jekyll-include_snippet 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: cb7932037b39484d03356a384926c06b979d84ab
4
- data.tar.gz: 3366224a0c3703f73e4c65398345d817dcd369ea
3
+ metadata.gz: 305febb9feb26637e9e49f2df6dfa0aef8b8adb0
4
+ data.tar.gz: 53c2dd21fc0c293242d3f7d217a9f2671e41fa9f
5
5
  SHA512:
6
- metadata.gz: a8d2f5773ff89da894e9a7850cf29deba329e9d48c9891ba4fe34a6936429adbb97a145f110b60e69ab99f1b419c0a2c538195c4c3bb43f4ab935eaf970cb623
7
- data.tar.gz: 138b7dcb594b31d6475b6d15901d33634e88258dd60f521e1208456340631a56126f0f7baa5c05743ef97063b1d2365e3f96c2160fdfc327970b98d1adec3a58
6
+ metadata.gz: b662ca4f9c5cee068093faab4298730aaa57fd048fb48e42f826c561cb2734fcb1191f0cfd10784d25fbc40fc5fc45aa09cc31edf2f9f37fba15d35a1a4e2e1f
7
+ data.tar.gz: 83a44f87ccb7c0fa174ee82e771ba1891111e012ae5e4ba11a4c1706696e107ea9992b734909f6e0dd04d573baa53a155860a8f7ccf780011a9db5ea8b1acf94
@@ -17,11 +17,12 @@ module Jekyll
17
17
  all_snippets = []
18
18
  active_snippets = []
19
19
 
20
- source.each_line do |line|
20
+ source.each_line.each_with_index do |line, lineno|
21
21
  case line
22
22
  when BEGIN_REGEX
23
23
  active_snippets << Snippet.new(name: $2.strip, indent: $1.length)
24
24
  when END_REGEX
25
+ raise missing_begin_snippet(lineno) if active_snippets.empty?
25
26
  all_snippets << active_snippets.pop
26
27
  else
27
28
  (active_snippets + [everything]).each do |snippet|
@@ -37,6 +38,19 @@ module Jekyll
37
38
 
38
39
  private
39
40
 
41
+ def missing_begin_snippet(lineno)
42
+ <<~END_ERROR
43
+ There was an `end-snippet` on line #{lineno}, but there doesn't
44
+ appear to be any matching `begin-snippet` line.
45
+
46
+ Make sure you have the correct `begin-snippet` comment --
47
+ something like this:
48
+
49
+ # begin-snippet: MyRadCode
50
+
51
+ END_ERROR
52
+ end
53
+
40
54
  class Snippet
41
55
  attr_reader :name, :indent, :lines
42
56
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module IncludeSnippet
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-include_snippet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Dalling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-22 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid