ngage 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/exe/ngage +55 -0
- data/lib/ngage.rb +3 -0
- data/lib/ngage/jekyll.rb +204 -0
- data/lib/ngage/jekyll/cleaner.rb +111 -0
- data/lib/ngage/jekyll/collection.rb +235 -0
- data/lib/ngage/jekyll/command.rb +103 -0
- data/lib/ngage/jekyll/commands/build.rb +93 -0
- data/lib/ngage/jekyll/commands/clean.rb +45 -0
- data/lib/ngage/jekyll/commands/doctor.rb +173 -0
- data/lib/ngage/jekyll/commands/help.rb +34 -0
- data/lib/ngage/jekyll/commands/new.rb +157 -0
- data/lib/ngage/jekyll/commands/new_theme.rb +42 -0
- data/lib/ngage/jekyll/commands/serve.rb +354 -0
- data/lib/ngage/jekyll/commands/serve/live_reload_reactor.rb +122 -0
- data/lib/ngage/jekyll/commands/serve/livereload_assets/livereload.js +1183 -0
- data/lib/ngage/jekyll/commands/serve/servlet.rb +203 -0
- data/lib/ngage/jekyll/commands/serve/websockets.rb +81 -0
- data/lib/ngage/jekyll/configuration.rb +391 -0
- data/lib/ngage/jekyll/converter.rb +54 -0
- data/lib/ngage/jekyll/converters/identity.rb +41 -0
- data/lib/ngage/jekyll/converters/markdown.rb +116 -0
- data/lib/ngage/jekyll/converters/markdown/kramdown_parser.rb +122 -0
- data/lib/ngage/jekyll/converters/smartypants.rb +70 -0
- data/lib/ngage/jekyll/convertible.rb +253 -0
- data/lib/ngage/jekyll/deprecator.rb +50 -0
- data/lib/ngage/jekyll/document.rb +503 -0
- data/lib/ngage/jekyll/drops/collection_drop.rb +20 -0
- data/lib/ngage/jekyll/drops/document_drop.rb +69 -0
- data/lib/ngage/jekyll/drops/drop.rb +209 -0
- data/lib/ngage/jekyll/drops/excerpt_drop.rb +15 -0
- data/lib/ngage/jekyll/drops/jekyll_drop.rb +32 -0
- data/lib/ngage/jekyll/drops/site_drop.rb +56 -0
- data/lib/ngage/jekyll/drops/static_file_drop.rb +14 -0
- data/lib/ngage/jekyll/drops/unified_payload_drop.rb +26 -0
- data/lib/ngage/jekyll/drops/url_drop.rb +89 -0
- data/lib/ngage/jekyll/entry_filter.rb +127 -0
- data/lib/ngage/jekyll/errors.rb +20 -0
- data/lib/ngage/jekyll/excerpt.rb +180 -0
- data/lib/ngage/jekyll/external.rb +76 -0
- data/lib/ngage/jekyll/filters.rb +390 -0
- data/lib/ngage/jekyll/filters/date_filters.rb +110 -0
- data/lib/ngage/jekyll/filters/grouping_filters.rb +64 -0
- data/lib/ngage/jekyll/filters/url_filters.rb +68 -0
- data/lib/ngage/jekyll/frontmatter_defaults.rb +233 -0
- data/lib/ngage/jekyll/generator.rb +5 -0
- data/lib/ngage/jekyll/hooks.rb +106 -0
- data/lib/ngage/jekyll/layout.rb +62 -0
- data/lib/ngage/jekyll/liquid_extensions.rb +22 -0
- data/lib/ngage/jekyll/liquid_renderer.rb +63 -0
- data/lib/ngage/jekyll/liquid_renderer/file.rb +56 -0
- data/lib/ngage/jekyll/liquid_renderer/table.rb +98 -0
- data/lib/ngage/jekyll/log_adapter.rb +151 -0
- data/lib/ngage/jekyll/mime.types +825 -0
- data/lib/ngage/jekyll/page.rb +185 -0
- data/lib/ngage/jekyll/page_without_a_file.rb +14 -0
- data/lib/ngage/jekyll/plugin.rb +92 -0
- data/lib/ngage/jekyll/plugin_manager.rb +115 -0
- data/lib/ngage/jekyll/publisher.rb +23 -0
- data/lib/ngage/jekyll/reader.rb +154 -0
- data/lib/ngage/jekyll/readers/collection_reader.rb +22 -0
- data/lib/ngage/jekyll/readers/data_reader.rb +75 -0
- data/lib/ngage/jekyll/readers/layout_reader.rb +70 -0
- data/lib/ngage/jekyll/readers/page_reader.rb +25 -0
- data/lib/ngage/jekyll/readers/post_reader.rb +72 -0
- data/lib/ngage/jekyll/readers/static_file_reader.rb +25 -0
- data/lib/ngage/jekyll/readers/theme_assets_reader.rb +51 -0
- data/lib/ngage/jekyll/regenerator.rb +195 -0
- data/lib/ngage/jekyll/related_posts.rb +52 -0
- data/lib/ngage/jekyll/renderer.rb +266 -0
- data/lib/ngage/jekyll/site.rb +476 -0
- data/lib/ngage/jekyll/static_file.rb +169 -0
- data/lib/ngage/jekyll/stevenson.rb +60 -0
- data/lib/ngage/jekyll/tags/highlight.rb +108 -0
- data/lib/ngage/jekyll/tags/include.rb +226 -0
- data/lib/ngage/jekyll/tags/link.rb +40 -0
- data/lib/ngage/jekyll/tags/post_url.rb +104 -0
- data/lib/ngage/jekyll/theme.rb +73 -0
- data/lib/ngage/jekyll/theme_builder.rb +121 -0
- data/lib/ngage/jekyll/url.rb +160 -0
- data/lib/ngage/jekyll/utils.rb +370 -0
- data/lib/ngage/jekyll/utils/ansi.rb +57 -0
- data/lib/ngage/jekyll/utils/exec.rb +26 -0
- data/lib/ngage/jekyll/utils/internet.rb +37 -0
- data/lib/ngage/jekyll/utils/platforms.rb +82 -0
- data/lib/ngage/jekyll/utils/thread_event.rb +31 -0
- data/lib/ngage/jekyll/utils/win_tz.rb +75 -0
- data/lib/ngage/site_template/.gitignore +5 -0
- data/lib/ngage/site_template/404.html +25 -0
- data/lib/ngage/site_template/_config.yml +47 -0
- data/lib/ngage/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -0
- data/lib/ngage/site_template/about.markdown +18 -0
- data/lib/ngage/site_template/index.markdown +6 -0
- data/lib/ngage/theme_template/CODE_OF_CONDUCT.md.erb +74 -0
- data/lib/ngage/theme_template/Gemfile +4 -0
- data/lib/ngage/theme_template/LICENSE.txt.erb +21 -0
- data/lib/ngage/theme_template/README.md.erb +52 -0
- data/lib/ngage/theme_template/_layouts/default.html +1 -0
- data/lib/ngage/theme_template/_layouts/page.html +5 -0
- data/lib/ngage/theme_template/_layouts/post.html +5 -0
- data/lib/ngage/theme_template/example/_config.yml.erb +1 -0
- data/lib/ngage/theme_template/example/_post.md +12 -0
- data/lib/ngage/theme_template/example/index.html +14 -0
- data/lib/ngage/theme_template/example/style.scss +7 -0
- data/lib/ngage/theme_template/gitignore.erb +6 -0
- data/lib/ngage/theme_template/theme.gemspec.erb +19 -0
- data/lib/ngage/version.rb +5 -0
- metadata +328 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class CollectionDrop < Drop
|
|
6
|
+
extend Forwardable
|
|
7
|
+
|
|
8
|
+
mutable false
|
|
9
|
+
|
|
10
|
+
def_delegator :@obj, :write?, :output
|
|
11
|
+
def_delegators :@obj, :label, :docs, :files, :directory, :relative_directory
|
|
12
|
+
|
|
13
|
+
private def_delegator :@obj, :metadata, :fallback_data
|
|
14
|
+
|
|
15
|
+
def to_s
|
|
16
|
+
docs.to_s
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class DocumentDrop < Drop
|
|
6
|
+
extend Forwardable
|
|
7
|
+
|
|
8
|
+
NESTED_OBJECT_FIELD_BLACKLIST = %w(
|
|
9
|
+
content output excerpt next previous
|
|
10
|
+
).freeze
|
|
11
|
+
|
|
12
|
+
mutable false
|
|
13
|
+
|
|
14
|
+
def_delegator :@obj, :relative_path, :path
|
|
15
|
+
def_delegators :@obj, :id, :output, :content, :to_s, :relative_path, :url
|
|
16
|
+
|
|
17
|
+
private def_delegator :@obj, :data, :fallback_data
|
|
18
|
+
|
|
19
|
+
def collection
|
|
20
|
+
@obj.collection.label
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def excerpt
|
|
24
|
+
fallback_data["excerpt"].to_s
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def <=>(other)
|
|
28
|
+
return nil unless other.is_a? DocumentDrop
|
|
29
|
+
|
|
30
|
+
cmp = self["date"] <=> other["date"]
|
|
31
|
+
cmp = self["path"] <=> other["path"] if cmp.nil? || cmp.zero?
|
|
32
|
+
cmp
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def previous
|
|
36
|
+
@obj.previous_doc.to_liquid
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def next
|
|
40
|
+
@obj.next_doc.to_liquid
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Generate a Hash for use in generating JSON.
|
|
44
|
+
# This is useful if fields need to be cleared before the JSON can generate.
|
|
45
|
+
#
|
|
46
|
+
# state - the JSON::State object which determines the state of current processing.
|
|
47
|
+
#
|
|
48
|
+
# Returns a Hash ready for JSON generation.
|
|
49
|
+
def hash_for_json(state = nil)
|
|
50
|
+
to_h.tap do |hash|
|
|
51
|
+
if state && state.depth >= 2
|
|
52
|
+
hash["previous"] = collapse_document(hash["previous"]) if hash["previous"]
|
|
53
|
+
hash["next"] = collapse_document(hash["next"]) if hash["next"]
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Generate a Hash which breaks the recursive chain.
|
|
59
|
+
# Certain fields which are normally available are omitted.
|
|
60
|
+
#
|
|
61
|
+
# Returns a Hash with only non-recursive fields present.
|
|
62
|
+
def collapse_document(doc)
|
|
63
|
+
doc.keys.each_with_object({}) do |(key, _), result|
|
|
64
|
+
result[key] = doc[key] unless NESTED_OBJECT_FIELD_BLACKLIST.include?(key)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class Drop < Liquid::Drop
|
|
6
|
+
include Enumerable
|
|
7
|
+
|
|
8
|
+
NON_CONTENT_METHODS = [:fallback_data, :collapse_document].freeze
|
|
9
|
+
|
|
10
|
+
# Get or set whether the drop class is mutable.
|
|
11
|
+
# Mutability determines whether or not pre-defined fields may be
|
|
12
|
+
# overwritten.
|
|
13
|
+
#
|
|
14
|
+
# is_mutable - Boolean set mutability of the class (default: nil)
|
|
15
|
+
#
|
|
16
|
+
# Returns the mutability of the class
|
|
17
|
+
def self.mutable(is_mutable = nil)
|
|
18
|
+
@is_mutable = is_mutable || false
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.mutable?
|
|
22
|
+
@is_mutable
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Create a new Drop
|
|
26
|
+
#
|
|
27
|
+
# obj - the Jekyll Site, Collection, or Document required by the
|
|
28
|
+
# drop.
|
|
29
|
+
#
|
|
30
|
+
# Returns nothing
|
|
31
|
+
def initialize(obj)
|
|
32
|
+
@obj = obj
|
|
33
|
+
@mutations = {} # only if mutable: true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Access a method in the Drop or a field in the underlying hash data.
|
|
37
|
+
# If mutable, checks the mutations first. Then checks the methods,
|
|
38
|
+
# and finally check the underlying hash (e.g. document front matter)
|
|
39
|
+
# if all the previous places didn't match.
|
|
40
|
+
#
|
|
41
|
+
# key - the string key whose value to fetch
|
|
42
|
+
#
|
|
43
|
+
# Returns the value for the given key, or nil if none exists
|
|
44
|
+
def [](key)
|
|
45
|
+
if self.class.mutable? && @mutations.key?(key)
|
|
46
|
+
@mutations[key]
|
|
47
|
+
elsif self.class.invokable? key
|
|
48
|
+
public_send key
|
|
49
|
+
else
|
|
50
|
+
fallback_data[key]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
alias_method :invoke_drop, :[]
|
|
54
|
+
|
|
55
|
+
# Set a field in the Drop. If mutable, sets in the mutations and
|
|
56
|
+
# returns. If not mutable, checks first if it's trying to override a
|
|
57
|
+
# Drop method and raises a DropMutationException if so. If not
|
|
58
|
+
# mutable and the key is not a method on the Drop, then it sets the
|
|
59
|
+
# key to the value in the underlying hash (e.g. document front
|
|
60
|
+
# matter)
|
|
61
|
+
#
|
|
62
|
+
# key - the String key whose value to set
|
|
63
|
+
# val - the Object to set the key's value to
|
|
64
|
+
#
|
|
65
|
+
# Returns the value the key was set to unless the Drop is not mutable
|
|
66
|
+
# and the key matches a method in which case it raises a
|
|
67
|
+
# DropMutationException.
|
|
68
|
+
def []=(key, val)
|
|
69
|
+
if respond_to?("#{key}=")
|
|
70
|
+
public_send("#{key}=", val)
|
|
71
|
+
elsif respond_to?(key.to_s)
|
|
72
|
+
if self.class.mutable?
|
|
73
|
+
@mutations[key] = val
|
|
74
|
+
else
|
|
75
|
+
raise Errors::DropMutationException, "Key #{key} cannot be set in the drop."
|
|
76
|
+
end
|
|
77
|
+
else
|
|
78
|
+
fallback_data[key] = val
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Generates a list of strings which correspond to content getter
|
|
83
|
+
# methods.
|
|
84
|
+
#
|
|
85
|
+
# Returns an Array of strings which represent method-specific keys.
|
|
86
|
+
def content_methods
|
|
87
|
+
@content_methods ||= (
|
|
88
|
+
self.class.instance_methods \
|
|
89
|
+
- Jekyll::Drops::Drop.instance_methods \
|
|
90
|
+
- NON_CONTENT_METHODS
|
|
91
|
+
).map(&:to_s).reject do |method|
|
|
92
|
+
method.end_with?("=")
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Check if key exists in Drop
|
|
97
|
+
#
|
|
98
|
+
# key - the string key whose value to fetch
|
|
99
|
+
#
|
|
100
|
+
# Returns true if the given key is present
|
|
101
|
+
def key?(key)
|
|
102
|
+
return false if key.nil?
|
|
103
|
+
return true if self.class.mutable? && @mutations.key?(key)
|
|
104
|
+
|
|
105
|
+
respond_to?(key) || fallback_data.key?(key)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Generates a list of keys with user content as their values.
|
|
109
|
+
# This gathers up the Drop methods and keys of the mutations and
|
|
110
|
+
# underlying data hashes and performs a set union to ensure a list
|
|
111
|
+
# of unique keys for the Drop.
|
|
112
|
+
#
|
|
113
|
+
# Returns an Array of unique keys for content for the Drop.
|
|
114
|
+
def keys
|
|
115
|
+
(content_methods |
|
|
116
|
+
@mutations.keys |
|
|
117
|
+
fallback_data.keys).flatten
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Generate a Hash representation of the Drop by resolving each key's
|
|
121
|
+
# value. It includes Drop methods, mutations, and the underlying object's
|
|
122
|
+
# data. See the documentation for Drop#keys for more.
|
|
123
|
+
#
|
|
124
|
+
# Returns a Hash with all the keys and values resolved.
|
|
125
|
+
def to_h
|
|
126
|
+
keys.each_with_object({}) do |(key, _), result|
|
|
127
|
+
result[key] = self[key]
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
alias_method :to_hash, :to_h
|
|
131
|
+
|
|
132
|
+
# Inspect the drop's keys and values through a JSON representation
|
|
133
|
+
# of its keys and values.
|
|
134
|
+
#
|
|
135
|
+
# Returns a pretty generation of the hash representation of the Drop.
|
|
136
|
+
def inspect
|
|
137
|
+
JSON.pretty_generate to_h
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Generate a Hash for use in generating JSON.
|
|
141
|
+
# This is useful if fields need to be cleared before the JSON can generate.
|
|
142
|
+
#
|
|
143
|
+
# Returns a Hash ready for JSON generation.
|
|
144
|
+
def hash_for_json(*)
|
|
145
|
+
to_h
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Generate a JSON representation of the Drop.
|
|
149
|
+
#
|
|
150
|
+
# state - the JSON::State object which determines the state of current processing.
|
|
151
|
+
#
|
|
152
|
+
# Returns a JSON representation of the Drop in a String.
|
|
153
|
+
def to_json(state = nil)
|
|
154
|
+
JSON.generate(hash_for_json(state), state)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Collects all the keys and passes each to the block in turn.
|
|
158
|
+
#
|
|
159
|
+
# block - a block which accepts one argument, the key
|
|
160
|
+
#
|
|
161
|
+
# Returns nothing.
|
|
162
|
+
def each_key(&block)
|
|
163
|
+
keys.each(&block)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def each
|
|
167
|
+
each_key.each do |key|
|
|
168
|
+
yield key, self[key]
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def merge(other, &block)
|
|
173
|
+
dup.tap do |me|
|
|
174
|
+
if block.nil?
|
|
175
|
+
me.merge!(other)
|
|
176
|
+
else
|
|
177
|
+
me.merge!(other, block)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def merge!(other)
|
|
183
|
+
other.each_key do |key|
|
|
184
|
+
if block_given?
|
|
185
|
+
self[key] = yield key, self[key], other[key]
|
|
186
|
+
else
|
|
187
|
+
if Utils.mergable?(self[key]) && Utils.mergable?(other[key])
|
|
188
|
+
self[key] = Utils.deep_merge_hashes(self[key], other[key])
|
|
189
|
+
next
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
self[key] = other[key] unless other[key].nil?
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Imitate Hash.fetch method in Drop
|
|
198
|
+
#
|
|
199
|
+
# Returns value if key is present in Drop, otherwise returns default value
|
|
200
|
+
# KeyError is raised if key is not present and no default value given
|
|
201
|
+
def fetch(key, default = nil, &block)
|
|
202
|
+
return self[key] if key?(key)
|
|
203
|
+
raise KeyError, %(key not found: "#{key}") if default.nil? && block.nil?
|
|
204
|
+
return yield(key) unless block.nil?
|
|
205
|
+
return default unless default.nil?
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class JekyllDrop < Liquid::Drop
|
|
6
|
+
class << self
|
|
7
|
+
def global
|
|
8
|
+
@global ||= JekyllDrop.new
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def version
|
|
13
|
+
Jekyll::VERSION
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def environment
|
|
17
|
+
Jekyll.env
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def to_h
|
|
21
|
+
@to_h ||= {
|
|
22
|
+
"version" => version,
|
|
23
|
+
"environment" => environment,
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_json(state = nil)
|
|
28
|
+
JSON.generate(to_h, state)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class SiteDrop < Drop
|
|
6
|
+
extend Forwardable
|
|
7
|
+
|
|
8
|
+
mutable false
|
|
9
|
+
|
|
10
|
+
def_delegator :@obj, :site_data, :data
|
|
11
|
+
def_delegators :@obj, :time, :pages, :static_files, :documents, :tags, :categories
|
|
12
|
+
|
|
13
|
+
private def_delegator :@obj, :config, :fallback_data
|
|
14
|
+
|
|
15
|
+
def [](key)
|
|
16
|
+
if key != "posts" && @obj.collections.key?(key)
|
|
17
|
+
@obj.collections[key].docs
|
|
18
|
+
else
|
|
19
|
+
super(key)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def key?(key)
|
|
24
|
+
(key != "posts" && @obj.collections.key?(key)) || super
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def posts
|
|
28
|
+
@site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def html_pages
|
|
32
|
+
@site_html_pages ||= @obj.pages.select do |page|
|
|
33
|
+
page.html? || page.url.end_with?("/")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def collections
|
|
38
|
+
@site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# `{{ site.related_posts }}` is how posts can get posts related to
|
|
42
|
+
# them, either through LSI if it's enabled, or through the most
|
|
43
|
+
# recent posts.
|
|
44
|
+
# We should remove this in 4.0 and switch to `{{ post.related_posts }}`.
|
|
45
|
+
def related_posts
|
|
46
|
+
return nil unless @current_document.is_a?(Jekyll::Document)
|
|
47
|
+
|
|
48
|
+
@current_document.related_posts
|
|
49
|
+
end
|
|
50
|
+
attr_writer :current_document
|
|
51
|
+
|
|
52
|
+
# return nil for `{{ site.config }}` even if --config was passed via CLI
|
|
53
|
+
def config; end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class StaticFileDrop < Drop
|
|
6
|
+
extend Forwardable
|
|
7
|
+
def_delegators :@obj, :name, :extname, :modified_time, :basename
|
|
8
|
+
def_delegator :@obj, :relative_path, :path
|
|
9
|
+
def_delegator :@obj, :type, :collection
|
|
10
|
+
|
|
11
|
+
private def_delegator :@obj, :data, :fallback_data
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Drops
|
|
5
|
+
class UnifiedPayloadDrop < Drop
|
|
6
|
+
mutable true
|
|
7
|
+
|
|
8
|
+
attr_accessor :page, :layout, :content, :paginator
|
|
9
|
+
attr_accessor :highlighter_prefix, :highlighter_suffix
|
|
10
|
+
|
|
11
|
+
def jekyll
|
|
12
|
+
JekyllDrop.global
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def site
|
|
16
|
+
@site_drop ||= SiteDrop.new(@obj)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fallback_data
|
|
22
|
+
@fallback_data ||= {}
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|