jekyll-optional-front-matter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87c57f05b8d4ee99eafa0aa57f03c2d9ab434587
4
+ data.tar.gz: 85095f5dd70bcfaa0af3ad15bff56bd267a33a1e
5
+ SHA512:
6
+ metadata.gz: d1f7ff3e067a5c704173af9ef7a7451a154310573a493067df37dd1fdb97e003043b0f9c17739e64a28eb54e4f71ba59ebd6a1fe2cfab0b42e191c278458e331
7
+ data.tar.gz: eb0b768b1b7a150df5c46653fc10a832baae1c9da2ab0c9fc7fd553217ce314c49fd5e58e0a382f0a6200ef008272ee24919b502c37ed215d198d15cece0816a
@@ -0,0 +1,5 @@
1
+ require "jekyll"
2
+
3
+ module JekyllOptionalFrontMatter
4
+ autoload :Generator, "jekyll-optional-front-matter/generator"
5
+ end
@@ -0,0 +1,39 @@
1
+ module JekyllOptionalFrontMatter
2
+ class Generator < Jekyll::Generator
3
+ attr_accessor :site
4
+
5
+ safe :true
6
+ priority :low
7
+
8
+ def initialize(site)
9
+ @site = site
10
+ end
11
+
12
+ def generate(site)
13
+ @site = site
14
+ return if site.config["require_front_matter"]
15
+ site.pages.concat(pages)
16
+ end
17
+
18
+ private
19
+
20
+ def pages
21
+ markdown_files.map { |static_file| page_from_static_file(static_file) }
22
+ end
23
+
24
+ def page_from_static_file(static_file)
25
+ base = static_file.instance_variable_get("@base")
26
+ dir = static_file.instance_variable_get("@dir")
27
+ name = static_file.instance_variable_get("@name")
28
+ Jekyll::Page.new(site, base, dir, name)
29
+ end
30
+
31
+ def markdown_files
32
+ site.static_files.select { |f| markdown_converter.matches(f.extname) }
33
+ end
34
+
35
+ def markdown_converter
36
+ site.find_converter_instance(Jekyll::Converters::Markdown)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module JekyllOptionalFrontMatter
2
+ VERSION = "0.0.1".freeze
3
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-optional-front-matter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ben Balter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.40'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.40'
55
+ description:
56
+ email:
57
+ - ben.balter@github.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/jekyll-optional-front-matter.rb
63
+ - lib/jekyll-optional-front-matter/generator.rb
64
+ - lib/jekyll-optional-front-matter/version.rb
65
+ homepage: https://github.com/benbalter/jekyll-optional-front-matter
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.6.6
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: A Jekyll plugin to make front matter optional for Markdown files
89
+ test_files: []