jekyll-fm 10.0.0 → 11.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 +8 -38
- 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: 8f810ca4258eef2cec27ccd1dd201426aeb93405
|
4
|
+
data.tar.gz: cfcf2416e9bd6d151513696f8a1487279c9f98dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe3dea317c6cf2e8bde1bfc7bb65b061d2290207ebf00affd587f0ed83871a71d4b6374e4e682177d00f0078b8c39fb020ca4d49b7c1e097f4af915fecbe04f
|
7
|
+
data.tar.gz: ae4c83034a7067b49602e97416144c82a210e20315cf2e7f2be58d1bf9a4f1eb42ab6bb46755a193844afe23c8bcc7dd1f6209065b97718d778b4f3ef5443d1f
|
data/lib/jekyll/fm.rb
CHANGED
@@ -1,45 +1,15 @@
|
|
1
|
-
require '
|
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
|
20
|
-
|
21
|
-
def syntax_from_pathname(pathname)
|
22
|
-
File.extname(pathname)[1..-1].to_sym
|
23
|
-
end
|
24
|
-
|
25
|
-
def parse_file(pathname)
|
26
|
-
syntax_parser |= syntax_from_pathname(pathname)
|
27
|
-
loader = Yaml.new
|
28
|
-
File.open(pathname) do |file|
|
29
|
-
new(syntax_parser, loader: loader).call(file.read)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
1
|
+
require 'front_matter_parser'
|
33
2
|
|
34
3
|
Jekyll::Hooks.register :site, :post_read do |site|
|
35
4
|
# Jekyll::Hooks.register :pages, :post_init do |pages|
|
36
5
|
puts site
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
6
|
+
# parsed = FrontMatterParser::Parser.parse_file('example.md')
|
7
|
+
# site.posts.each do |f|
|
8
|
+
# puts "f.path: #{f.path}"
|
9
|
+
# # file_path = File.join("_#{collection}", md_path)
|
10
|
+
# file = parse_file(f.path)
|
11
|
+
# puts "file: #{file}"
|
12
|
+
# end
|
43
13
|
# InjectorPlugin::Hola.hi
|
44
14
|
end
|
45
15
|
|