front_matter_parser 0.1.1 → 0.2.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
  SHA1:
3
- metadata.gz: 5d5e6ab289e911c8eef0b4890f1dd8ff48f9d21a
4
- data.tar.gz: 29aac6299a32dcfcc18bd770f3b078b440767455
3
+ metadata.gz: 7cece9fa4c0d1a296029a0c61e2277cfa827420c
4
+ data.tar.gz: 88defaeee5b65d961b489ef628a300da0961a4e8
5
5
  SHA512:
6
- metadata.gz: cf889dea7373a1441d733deb02812fe0894aa1b549f53ddbad3229cb4ebeae1a108debc562e4bc7b0d6eb949ef6b8afcda9d7399c3cab6bca0979a30fed71954
7
- data.tar.gz: 81803add1d8eea7140d4e9c8a3cd559ce8b2f2ab191e9bec3e98def6c28fb5780471b341cc476712aaf763a53801414c6a6eea5b334374ab35634c4702e14e27
6
+ metadata.gz: afe7ea04569d7c18d789167256a73688941b69222c864b745ac8200ca65f75a4be5ea4787c3aea46b1c0a61bce852ff70a62a3682816c3c29279ad9352c69c41
7
+ data.tar.gz: 96174298050130a8a990b7b3a3e15b2c367adb4559954e7672084715af941f739e571ff491ba1142296c4935e60397b75f683adb4c6ed11f67b2eb4c0b1427a8
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [0.2.0] - 2018-06-11
8
+ ### Added
9
+ - Allow whitelisting classes in YAML loader.
10
+
7
11
  ## [0.1.1] - 2017-07-19
8
12
  ### Fixed
9
13
  - Don't be greedy with front matter end delimiters
data/README.md CHANGED
@@ -75,19 +75,17 @@ title = FrontMatterParser::Parser.parse_file('example.haml')['title'] #=> 'Hello
75
75
 
76
76
  Following there is a relation of known syntaxes and their known comment delimiters:
77
77
 
78
- <pre>
79
78
  | Syntax | Single line comment | Start multiline comment | End multiline comment |
80
79
  | ------ | ------------------- | ----------------------- | ---------------------- |
81
80
  | haml | | -# | (indentation) |
82
81
  | slim | | / | (indentation) |
83
82
  | liquid | | {% comment %} | {% endcomment %} |
84
83
  | md | | | |
85
- | html | | &lt;!-- | --&gt; |
86
- | erb | | &lt;%# | %&gt; |
84
+ | html | | &lt;!-- | --&gt; |
85
+ | erb | | &lt;%# | %&gt; |
87
86
  | coffee | # | | |
88
87
  | sass | // | | |
89
88
  | scss | // | | |
90
- </pre>
91
89
 
92
90
  ### Parsing a string
93
91
 
@@ -136,6 +134,14 @@ FrontMatterParser::Parser.parse_file('example.md', loader: json_loader)
136
134
  FrontMatterParser::Parser.new(:md, loader: json_loader).call(string)
137
135
  ```
138
136
 
137
+ If you need to whitelist some class for the built-in YAML loader, you can just create a custom loader based on it and provide needed classes in a `whitelisted_classes:` param:
138
+
139
+ ```ruby
140
+ loader = FrontMatterParser::Loader::Yaml.new(whitelisted_classes: [Time])
141
+ parsed = FrontMatterParser::Parser.parse_file('example.md', loader: loader)
142
+ puts parsed['timestamp']
143
+ ```
144
+
139
145
  ## Development
140
146
 
141
147
  There are docker and docker-compose files configured to create a development environment for this gem. So, if you use Docker you only need to run:
@@ -6,12 +6,20 @@ module FrontMatterParser
6
6
  module Loader
7
7
  # {Loader} that uses YAML library
8
8
  class Yaml
9
+ # @!attribute [r] whitelist_classes
10
+ # Classes that may be parsed by #call.
11
+ attr_reader :whitelist_classes
12
+
13
+ def initialize(whitelist_classes: [])
14
+ @whitelist_classes = whitelist_classes
15
+ end
16
+
9
17
  # Loads a hash front matter from a string
10
18
  #
11
19
  # @param string [String] front matter string representation
12
20
  # @return [Hash] front matter hash representation
13
- def self.call(string)
14
- YAML.safe_load(string)
21
+ def call(string)
22
+ YAML.safe_load(string, whitelist_classes)
15
23
  end
16
24
  end
17
25
  end
@@ -18,8 +18,9 @@ module FrontMatterParser
18
18
  # @param syntax_parser [Object] see {SyntaxParser}
19
19
  # @param loader [Object] see {Loader}
20
20
  # @return [Parsed] parsed front matter and content
21
- def self.parse_file(pathname, syntax_parser: nil, loader: Loader::Yaml)
21
+ def self.parse_file(pathname, syntax_parser: nil, loader: nil)
22
22
  syntax_parser ||= syntax_from_pathname(pathname)
23
+ loader ||= Loader::Yaml.new
23
24
  File.open(pathname) do |file|
24
25
  new(syntax_parser, loader: loader).call(file.read)
25
26
  end
@@ -49,7 +50,7 @@ module FrontMatterParser
49
50
  #
50
51
  # @param loader [Object] Front matter loader to use. See {Loader} for
51
52
  # details.
52
- def initialize(syntax_parser, loader: Loader::Yaml)
53
+ def initialize(syntax_parser, loader: Loader::Yaml.new)
53
54
  @syntax_parser = infer_syntax_parser(syntax_parser)
54
55
  @loader = loader
55
56
  end
@@ -43,6 +43,7 @@ module FrontMatterParser
43
43
  \z
44
44
  /mx
45
45
  end
46
+ # rubocop:enable Metrics/MethodLength
46
47
  end
47
48
  end
48
49
  end
@@ -44,6 +44,7 @@ module FrontMatterParser
44
44
  \z
45
45
  /mx
46
46
  end
47
+ # rubocop:enable Metrics/MethodLength
47
48
  end
48
49
  end
49
50
  end
@@ -58,6 +58,7 @@ module FrontMatterParser
58
58
  \z
59
59
  /mx
60
60
  end
61
+ # rubocop:enable Metrics/MethodLength
61
62
  end
62
63
  end
63
64
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FrontMatterParser
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -3,13 +3,22 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe FrontMatterParser::Loader::Yaml do
6
- describe '::call' do
6
+ describe '#call' do
7
7
  it 'loads using yaml parser' do
8
8
  string = "title: 'hello'"
9
9
 
10
- expect(described_class.call(string)).to eq(
10
+ expect(described_class.new.call(string)).to eq(
11
11
  'title' => 'hello'
12
12
  )
13
13
  end
14
+
15
+ it 'loads with whitelisted classes' do
16
+ string = 'timestamp: 2017-10-17 00:00:00Z'
17
+ params = { whitelist_classes: [Time] }
18
+
19
+ expect(described_class.new(params).call(string)).to eq(
20
+ 'timestamp' => Time.parse('2017-10-17 00:00:00Z')
21
+ )
22
+ end
14
23
  end
15
24
  end
@@ -8,14 +8,14 @@ describe FrontMatterParser::Parser do
8
8
 
9
9
  describe '#call' do
10
10
  let(:string) do
11
- <<~eos
11
+ <<~STRING
12
12
  <!--
13
13
  ---
14
14
  title: hello
15
15
  ---
16
16
  -->
17
17
  Content
18
- eos
18
+ STRING
19
19
  end
20
20
 
21
21
  it 'parses using given parser' do
@@ -8,17 +8,17 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
8
8
  let(:front_matter) { { 'title' => 'hello', 'author' => 'me' } }
9
9
  let(:content) { "Content\n" }
10
10
 
11
- context 'slim' do
11
+ context 'when syntax is slim' do
12
12
  let(:syntax) { :slim }
13
13
  let(:string) do
14
- <<~eos
14
+ <<~STRING
15
15
  /
16
16
  ---
17
17
  title: hello
18
18
  author: me
19
19
  ---
20
20
  Content
21
- eos
21
+ STRING
22
22
  end
23
23
 
24
24
  it 'can parse it' do
@@ -26,17 +26,17 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
26
26
  end
27
27
  end
28
28
 
29
- context 'haml' do
29
+ context 'when syntax is haml' do
30
30
  let(:syntax) { :haml }
31
31
  let(:string) do
32
- <<~eos
32
+ <<~STRING
33
33
  -#
34
34
  ---
35
35
  title: hello
36
36
  author: me
37
37
  ---
38
38
  Content
39
- eos
39
+ STRING
40
40
  end
41
41
 
42
42
  it 'can parse it' do
@@ -47,7 +47,7 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
47
47
  context 'with space before comment delimiter' do
48
48
  let(:syntax) { :slim }
49
49
  let(:string) do
50
- <<~eos
50
+ <<~STRING
51
51
 
52
52
  /
53
53
  ---
@@ -55,7 +55,7 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
55
55
  author: me
56
56
  ---
57
57
  Content
58
- eos
58
+ STRING
59
59
  end
60
60
 
61
61
  it 'can parse it' do
@@ -66,13 +66,13 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
66
66
  context 'with front matter starting in comment delimiter line' do
67
67
  let(:syntax) { :slim }
68
68
  let(:string) do
69
- <<~eos
69
+ <<~STRING
70
70
  /---
71
71
  title: hello
72
72
  author: me
73
73
  ---
74
74
  Content
75
- eos
75
+ STRING
76
76
  end
77
77
 
78
78
  it 'can parse it' do
@@ -83,7 +83,7 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
83
83
  context 'with space before front matter' do
84
84
  let(:syntax) { :slim }
85
85
  let(:string) do
86
- <<~eos
86
+ <<~STRING
87
87
  /
88
88
 
89
89
  ---
@@ -91,7 +91,7 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
91
91
  author: me
92
92
  ---
93
93
  Content
94
- eos
94
+ STRING
95
95
  end
96
96
 
97
97
  it 'can parse it' do
@@ -102,7 +102,7 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
102
102
  context 'with space within front matter' do
103
103
  let(:syntax) { :slim }
104
104
  let(:string) do
105
- <<~eos
105
+ <<~STRING
106
106
  /
107
107
  ---
108
108
  title: hello
@@ -110,7 +110,7 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
110
110
  author: me
111
111
  ---
112
112
  Content
113
- eos
113
+ STRING
114
114
  end
115
115
 
116
116
  it 'can parse it' do
@@ -121,14 +121,14 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
121
121
  context 'with comment delimiter in the front matter' do
122
122
  let(:syntax) { :slim }
123
123
  let(:string) do
124
- <<~eos
124
+ <<~STRING
125
125
  /
126
126
  ---
127
127
  title: /hello
128
128
  author: me
129
129
  ---
130
130
  Content
131
- eos
131
+ STRING
132
132
  end
133
133
 
134
134
  it 'can parse it' do
@@ -141,14 +141,14 @@ describe FrontMatterParser::SyntaxParser::IndentationComment do
141
141
  context 'with front matter delimiter chars in the content' do
142
142
  let(:syntax) { :slim }
143
143
  let(:string) do
144
- <<~eos
144
+ <<~STRING
145
145
  /
146
146
  ---
147
147
  title: hello
148
148
  ---
149
149
  Content
150
150
  ---
151
- eos
151
+ STRING
152
152
  end
153
153
 
154
154
  it 'is not greedy' do
@@ -8,10 +8,10 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
8
8
  let(:front_matter) { { 'title' => 'hello', 'author' => 'me' } }
9
9
  let(:content) { "Content\n" }
10
10
 
11
- context 'html' do
11
+ context 'when syntax is html' do
12
12
  let(:syntax) { :html }
13
13
  let(:string) do
14
- <<~eos
14
+ <<~STRING
15
15
  <!--
16
16
  ---
17
17
  title: hello
@@ -19,7 +19,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
19
19
  ---
20
20
  -->
21
21
  Content
22
- eos
22
+ STRING
23
23
  end
24
24
 
25
25
  it 'can parse it' do
@@ -27,10 +27,10 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
27
27
  end
28
28
  end
29
29
 
30
- context 'erb' do
30
+ context 'when syntax is erb' do
31
31
  let(:syntax) { :erb }
32
32
  let(:string) do
33
- <<~eos
33
+ <<~STRING
34
34
  <%#
35
35
  ---
36
36
  title: hello
@@ -38,7 +38,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
38
38
  ---
39
39
  %>
40
40
  Content
41
- eos
41
+ STRING
42
42
  end
43
43
 
44
44
  it 'can parse it' do
@@ -46,10 +46,10 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
46
46
  end
47
47
  end
48
48
 
49
- context 'liquid' do
49
+ context 'when syntax is liquid' do
50
50
  let(:syntax) { :liquid }
51
51
  let(:string) do
52
- <<~eos
52
+ <<~STRING
53
53
  {% comment %}
54
54
  ---
55
55
  title: hello
@@ -57,7 +57,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
57
57
  ---
58
58
  {% endcomment %}
59
59
  Content
60
- eos
60
+ STRING
61
61
  end
62
62
 
63
63
  it 'can parse it' do
@@ -65,16 +65,16 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
65
65
  end
66
66
  end
67
67
 
68
- context 'md' do
68
+ context 'when syntax is md' do
69
69
  let(:syntax) { :md }
70
70
  let(:string) do
71
- <<~eos
71
+ <<~STRING
72
72
  ---
73
73
  title: hello
74
74
  author: me
75
75
  ---
76
76
  Content
77
- eos
77
+ STRING
78
78
  end
79
79
 
80
80
  it 'can parse it' do
@@ -85,7 +85,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
85
85
  context 'with space before start comment delimiter' do
86
86
  let(:syntax) { :html }
87
87
  let(:string) do
88
- <<~eos
88
+ <<~STRING
89
89
 
90
90
  <!--
91
91
  ---
@@ -94,7 +94,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
94
94
  ---
95
95
  -->
96
96
  Content
97
- eos
97
+ STRING
98
98
  end
99
99
 
100
100
  it 'can parse it' do
@@ -105,14 +105,14 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
105
105
  context 'with front matter starting in comment delimiter line' do
106
106
  let(:syntax) { :html }
107
107
  let(:string) do
108
- <<~eos
108
+ <<~STRING
109
109
  <!-- ---
110
110
  title: hello
111
111
  author: me
112
112
  ---
113
113
  -->
114
114
  Content
115
- eos
115
+ STRING
116
116
  end
117
117
 
118
118
  it 'can parse it' do
@@ -123,7 +123,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
123
123
  context 'with space before front matter' do
124
124
  let(:syntax) { :html }
125
125
  let(:string) do
126
- <<~eos
126
+ <<~STRING
127
127
  <!--
128
128
 
129
129
  ---
@@ -132,7 +132,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
132
132
  ---
133
133
  -->
134
134
  Content
135
- eos
135
+ STRING
136
136
  end
137
137
 
138
138
  it 'can parse it' do
@@ -143,7 +143,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
143
143
  context 'with space within front matter' do
144
144
  let(:syntax) { :html }
145
145
  let(:string) do
146
- <<~eos
146
+ <<~STRING
147
147
  <!--
148
148
  ---
149
149
  title: hello
@@ -152,7 +152,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
152
152
  ---
153
153
  -->
154
154
  Content
155
- eos
155
+ STRING
156
156
  end
157
157
 
158
158
  it 'can parse it' do
@@ -163,7 +163,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
163
163
  context 'with space after front matter' do
164
164
  let(:syntax) { :html }
165
165
  let(:string) do
166
- <<~eos
166
+ <<~STRING
167
167
  <!--
168
168
  ---
169
169
  title: hello
@@ -172,7 +172,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
172
172
 
173
173
  -->
174
174
  Content
175
- eos
175
+ STRING
176
176
  end
177
177
 
178
178
  it 'can parse it' do
@@ -183,7 +183,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
183
183
  context 'with space before end comment delimiter' do
184
184
  let(:syntax) { :html }
185
185
  let(:string) do
186
- <<~eos
186
+ <<~STRING
187
187
  <!--
188
188
  ---
189
189
  title: hello
@@ -191,7 +191,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
191
191
  ---
192
192
  -->
193
193
  Content
194
- eos
194
+ STRING
195
195
  end
196
196
 
197
197
  it 'can parse it' do
@@ -202,7 +202,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
202
202
  context 'with start comment delimiter in the front matter' do
203
203
  let(:syntax) { :html }
204
204
  let(:string) do
205
- <<~eos
205
+ <<~STRING
206
206
  <!--
207
207
  ---
208
208
  title: <!--hello
@@ -210,7 +210,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
210
210
  ---
211
211
  -->
212
212
  Content
213
- eos
213
+ STRING
214
214
  end
215
215
 
216
216
  it 'can parse it' do
@@ -223,7 +223,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
223
223
  context 'with start and end comment delimiter in the front matter' do
224
224
  let(:syntax) { :html }
225
225
  let(:string) do
226
- <<~eos
226
+ <<~STRING
227
227
  <!--
228
228
  ---
229
229
  title: <!--hello-->
@@ -231,7 +231,7 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
231
231
  ---
232
232
  -->
233
233
  Content
234
- eos
234
+ STRING
235
235
  end
236
236
 
237
237
  it 'can parse it' do
@@ -244,12 +244,12 @@ describe FrontMatterParser::SyntaxParser::MultiLineComment do
244
244
  context 'with front matter delimiter chars in the content' do
245
245
  let(:syntax) { :md }
246
246
  let(:string) do
247
- <<~eos
247
+ <<~STRING
248
248
  ---
249
249
  title: hello
250
250
  ---
251
251
  Content---
252
- eos
252
+ STRING
253
253
  end
254
254
 
255
255
  it 'is not greedy' do
@@ -8,16 +8,16 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
8
8
  let(:front_matter) { { 'title' => 'hello', 'author' => 'me' } }
9
9
  let(:content) { "Content\n" }
10
10
 
11
- context 'coffee' do
11
+ context 'when syntax is coffee' do
12
12
  let(:syntax) { :coffee }
13
13
  let(:string) do
14
- <<~eos
14
+ <<~STRING
15
15
  #---
16
16
  #title: hello
17
17
  #author: me
18
18
  #---
19
19
  Content
20
- eos
20
+ STRING
21
21
  end
22
22
 
23
23
  it 'can parse it' do
@@ -25,16 +25,16 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
25
25
  end
26
26
  end
27
27
 
28
- context 'sass' do
28
+ context 'when syntax is sass' do
29
29
  let(:syntax) { :sass }
30
30
  let(:string) do
31
- <<~eos
31
+ <<~STRING
32
32
  //---
33
33
  //title: hello
34
34
  //author: me
35
35
  //---
36
36
  Content
37
- eos
37
+ STRING
38
38
  end
39
39
 
40
40
  it 'can parse it' do
@@ -42,16 +42,16 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
42
42
  end
43
43
  end
44
44
 
45
- context 'scss' do
45
+ context 'when syntax is scss' do
46
46
  let(:syntax) { :scss }
47
47
  let(:string) do
48
- <<~eos
48
+ <<~STRING
49
49
  //---
50
50
  //title: hello
51
51
  //author: me
52
52
  //---
53
53
  Content
54
- eos
54
+ STRING
55
55
  end
56
56
 
57
57
  it 'can parse it' do
@@ -62,13 +62,13 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
62
62
  context 'with space before comment delimiters' do
63
63
  let(:syntax) { :coffee }
64
64
  let(:string) do
65
- <<~eos
65
+ <<~STRING
66
66
  #---
67
67
  #title: hello
68
68
  #author: me
69
69
  #---
70
70
  Content
71
- eos
71
+ STRING
72
72
  end
73
73
 
74
74
  it 'can parse it' do
@@ -79,13 +79,13 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
79
79
  context 'with space between comment delimiters and front matter' do
80
80
  let(:syntax) { :coffee }
81
81
  let(:string) do
82
- <<~eos
82
+ <<~STRING
83
83
  # ---
84
84
  # title: hello
85
85
  # author: me
86
86
  # ---
87
87
  Content
88
- eos
88
+ STRING
89
89
  end
90
90
 
91
91
  it 'can parse it' do
@@ -96,14 +96,14 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
96
96
  context 'with space within front matter' do
97
97
  let(:syntax) { :coffee }
98
98
  let(:string) do
99
- <<~eos
99
+ <<~STRING
100
100
  # ---
101
101
  # title: hello
102
102
  #
103
103
  # author: me
104
104
  # ---
105
105
  Content
106
- eos
106
+ STRING
107
107
  end
108
108
 
109
109
  it 'can parse it' do
@@ -114,14 +114,14 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
114
114
  context 'with uncommented lines between front matter' do
115
115
  let(:syntax) { :coffee }
116
116
  let(:string) do
117
- <<~eos
117
+ <<~STRING
118
118
  # ---
119
119
  # title: hello
120
120
 
121
121
  # author: me
122
122
  # ---
123
123
  Content
124
- eos
124
+ STRING
125
125
  end
126
126
 
127
127
  it 'can parse it' do
@@ -132,13 +132,13 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
132
132
  context 'with comment delimiter in the front matter' do
133
133
  let(:syntax) { :sass }
134
134
  let(:string) do
135
- <<~eos
135
+ <<~STRING
136
136
  //---
137
137
  //title: //hello
138
138
  //author: me
139
139
  //---
140
140
  Content
141
- eos
141
+ STRING
142
142
  end
143
143
 
144
144
  it 'can parse it' do
@@ -151,13 +151,13 @@ describe FrontMatterParser::SyntaxParser::SingleLineComment do
151
151
  context 'with front matter delimiter chars in the content' do
152
152
  let(:syntax) { :sass }
153
153
  let(:string) do
154
- <<~eos
154
+ <<~STRING
155
155
  //---
156
156
  //title: hello
157
157
  //---
158
158
  //---
159
159
  Content
160
- eos
160
+ STRING
161
161
  end
162
162
 
163
163
  it 'is not greedy' do
@@ -4,9 +4,9 @@ require 'simplecov'
4
4
 
5
5
  SimpleCov.start
6
6
 
7
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
7
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
8
8
  require 'front_matter_parser'
9
9
  require 'pry-byebug'
10
- Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file|
10
+ Dir["#{File.expand_path('support', __dir__)}/*.rb"].each do |file|
11
11
  require file
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: front_matter_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - marc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2018-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler