jekyll 3.8.4 → 3.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30ddb55605e1faf1274aee9fbec6d856867e35495abc6ad30f79ed7ac17b42c6
4
- data.tar.gz: 1351677a06924f50eb7569cea85c546bab2abbe85e48363e3203a57ebe5364be
3
+ metadata.gz: ed516471d3283099829df11941c1aa3ade27332a31a5bf0dcfb619a140ded8a6
4
+ data.tar.gz: de439ebe40081f3e2160d8e3d3f773652b032691c0b8d0092d102a73c47f66b5
5
5
  SHA512:
6
- metadata.gz: f572c520a00fe7d2cc537ee75f572f293d1efdf6ae2638ffd08df0b0964ecda165e000f8fc16bb70f0d058ae70beea391d2974a6b24c7c0755b77241b7a39317
7
- data.tar.gz: a66258b04e2b5223cda4c937cfbfa4faa7f3a2827fb737609760bd36feec962c1be04d8a7a3520345342c50aa9ebb87958e30f10a743c02f0bb8f7e97db30d4e
6
+ metadata.gz: abf95c2ca9b932059d82fa7f99cb62602f9c15c10d23b83245caadaa2591f1ab23286ca08eaeb010c8287c2a2f86a5f66d52e87559067ea1da981e008095542a
7
+ data.tar.gz: a14c8e1ae6e4f1ea6b07c203b8c2c0fa0cd22acfc72083d7ddb024527af0b605c4644ff1c455e127dc63d6828c518aa66f3b2703f3e9eae586a3d48cf9fdd566
@@ -128,36 +128,47 @@ module Jekyll
128
128
  #
129
129
  # Returns excerpt String
130
130
 
131
- LIQUID_TAG_REGEX = %r!{%-?\s*(\w+).+\s*-?%}!m
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 (to a Liquid block), to the "head" if the
138
- # partitioning resulted in leaving the closing tag somewhere in the "tail"
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
- if liquid_block?(tag_name) && head.match(%r!{%-?\s*end#{tag_name}\s*-?%}!).nil?
145
- print_build_warning
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
- head
152
- else
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
- Liquid::Template.tags[tag_name].superclass == Liquid::Block
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
- "Found a Liquid block containing separator '#{doc.excerpt_separator}' and has " \
172
- "been modified with the appropriate closing tag."
173
- Jekyll.logger.warn "",
174
- "Feel free to define a custom excerpt or excerpt_separator in the document's " \
175
- "Front Matter if the generated excerpt is unsatisfactory."
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jekyll
4
- VERSION = "3.8.4".freeze
4
+ VERSION = "3.8.5".freeze
5
5
  end
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
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-09-18 00:00:00.000000000 Z
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: 3.0.0.beta1
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.