jekyll 3.8.4 → 3.8.5
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 +4 -4
- data/lib/jekyll/excerpt.rb +33 -21
- data/lib/jekyll/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed516471d3283099829df11941c1aa3ade27332a31a5bf0dcfb619a140ded8a6
|
4
|
+
data.tar.gz: de439ebe40081f3e2160d8e3d3f773652b032691c0b8d0092d102a73c47f66b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abf95c2ca9b932059d82fa7f99cb62602f9c15c10d23b83245caadaa2591f1ab23286ca08eaeb010c8287c2a2f86a5f66d52e87559067ea1da981e008095542a
|
7
|
+
data.tar.gz: a14c8e1ae6e4f1ea6b07c203b8c2c0fa0cd22acfc72083d7ddb024527af0b605c4644ff1c455e127dc63d6828c518aa66f3b2703f3e9eae586a3d48cf9fdd566
|
data/lib/jekyll/excerpt.rb
CHANGED
@@ -128,36 +128,47 @@ module Jekyll
|
|
128
128
|
#
|
129
129
|
# Returns excerpt String
|
130
130
|
|
131
|
-
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+)
|
131
|
+
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+)\s*.*?-?%}!m
|
132
132
|
MKDWN_LINK_REF_REGEX = %r!^ {0,3}\[[^\]]+\]:.+$!
|
133
133
|
|
134
134
|
def extract_excerpt(doc_content)
|
135
135
|
head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
|
136
136
|
|
137
|
-
# append appropriate closing tag (
|
138
|
-
# partitioning resulted in leaving the closing tag somewhere
|
139
|
-
# partition.
|
140
|
-
if head.include?("{%")
|
141
|
-
head =~ LIQUID_TAG_REGEX
|
142
|
-
tag_name = Regexp.last_match(1)
|
137
|
+
# append appropriate closing tag(s) (for each Liquid block), to the `head`
|
138
|
+
# if the partitioning resulted in leaving the closing tag somewhere
|
139
|
+
# in the `tail` partition.
|
143
140
|
|
144
|
-
|
145
|
-
|
141
|
+
if head.include?("{%")
|
142
|
+
modified = false
|
143
|
+
tag_names = head.scan(LIQUID_TAG_REGEX)
|
144
|
+
tag_names.flatten!
|
145
|
+
tag_names.reverse_each do |tag_name|
|
146
|
+
next unless liquid_block?(tag_name)
|
147
|
+
next if head =~ endtag_regex_stash(tag_name)
|
148
|
+
|
149
|
+
modified = true
|
146
150
|
head << "\n{% end#{tag_name} %}"
|
147
151
|
end
|
152
|
+
print_build_warning if modified
|
148
153
|
end
|
149
154
|
|
150
|
-
if tail.empty?
|
151
|
-
|
152
|
-
|
153
|
-
head.to_s.dup << "\n\n" << tail.scan(MKDWN_LINK_REF_REGEX).join("\n")
|
154
|
-
end
|
155
|
+
return head if tail.empty?
|
156
|
+
|
157
|
+
head << "\n\n" << tail.scan(MKDWN_LINK_REF_REGEX).join("\n")
|
155
158
|
end
|
156
159
|
|
157
160
|
private
|
158
161
|
|
162
|
+
def endtag_regex_stash(tag_name)
|
163
|
+
@endtag_regex_stash ||= {}
|
164
|
+
@endtag_regex_stash[tag_name] ||= %r!{%-?\s*end#{tag_name}.*?\s*-?%}!m
|
165
|
+
end
|
166
|
+
|
159
167
|
def liquid_block?(tag_name)
|
160
|
-
|
168
|
+
return false unless tag_name.is_a?(String)
|
169
|
+
return false if tag_name.start_with?("end")
|
170
|
+
|
171
|
+
Liquid::Template.tags[tag_name].ancestors.include?(Liquid::Block)
|
161
172
|
rescue NoMethodError
|
162
173
|
Jekyll.logger.error "Error:",
|
163
174
|
"A Liquid tag in the excerpt of #{doc.relative_path} couldn't be " \
|
@@ -167,12 +178,13 @@ module Jekyll
|
|
167
178
|
|
168
179
|
def print_build_warning
|
169
180
|
Jekyll.logger.warn "Warning:", "Excerpt modified in #{doc.relative_path}!"
|
170
|
-
Jekyll.logger.warn "",
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
181
|
+
Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator" \
|
182
|
+
" #{doc.excerpt_separator.inspect}. "
|
183
|
+
Jekyll.logger.warn "", "The block has been modified with the appropriate" \
|
184
|
+
" closing tag."
|
185
|
+
Jekyll.logger.warn "", "Feel free to define a custom excerpt or" \
|
186
|
+
" excerpt_separator in the document's front matter" \
|
187
|
+
" if the generated excerpt is unsatisfactory."
|
176
188
|
end
|
177
189
|
end
|
178
190
|
end
|
data/lib/jekyll/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -328,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
328
|
version: '0'
|
329
329
|
requirements: []
|
330
330
|
rubyforge_project:
|
331
|
-
rubygems_version:
|
331
|
+
rubygems_version: 2.7.6
|
332
332
|
signing_key:
|
333
333
|
specification_version: 2
|
334
334
|
summary: A simple, blog aware, static site generator.
|