jekyll-fm 9.0.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/fm.rb +20 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea378d28c559ef9175487ff31cf6b995707243cd
|
4
|
+
data.tar.gz: bb3ee8a16b91d2b8baf9eb419a20f96b5ed4de24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4364d349489e865f3f81653be29c5d32618517add1d12fa6bb8e96d13200f71310be69a5df6831a16c2e5c5d7bf46b968a63b2fd0450813181e005743986924
|
7
|
+
data.tar.gz: 99eea316290ae1c3f92dbeaccd6b770dabb236aec0a1abc83b24dffa52dc575c37962ea9e144b75ea22a5e2b1f62dc5242434feebdf4d40e84fac80ba6a3eff1
|
data/lib/jekyll/fm.rb
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Yaml
|
4
|
+
# @!attribute [r] whitelist_classes
|
5
|
+
# Classes that may be parsed by #call.
|
6
|
+
attr_reader :whitelist_classes
|
7
|
+
|
8
|
+
def initialize(whitelist_classes: [])
|
9
|
+
@whitelist_classes = whitelist_classes
|
10
|
+
end
|
11
|
+
|
12
|
+
# Loads a hash front matter from a string
|
13
|
+
#
|
14
|
+
# @param string [String] front matter string representation
|
15
|
+
# @return [Hash] front matter hash representation
|
16
|
+
def call(string)
|
17
|
+
YAML.safe_load(string, whitelist_classes)
|
18
|
+
end
|
19
|
+
end
|
1
20
|
|
2
21
|
def syntax_from_pathname(pathname)
|
3
22
|
File.extname(pathname)[1..-1].to_sym
|
@@ -5,7 +24,7 @@ end
|
|
5
24
|
|
6
25
|
def parse_file(pathname)
|
7
26
|
syntax_parser |= syntax_from_pathname(pathname)
|
8
|
-
loader =
|
27
|
+
loader = Yaml.new
|
9
28
|
File.open(pathname) do |file|
|
10
29
|
new(syntax_parser, loader: loader).call(file.read)
|
11
30
|
end
|