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 +4 -4
- data/lib/jekyll/include_snippet/extractor.rb +15 -1
- data/lib/jekyll/include_snippet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 305febb9feb26637e9e49f2df6dfa0aef8b8adb0
|
4
|
+
data.tar.gz: 53c2dd21fc0c293242d3f7d217a9f2671e41fa9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
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.
|
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-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|