jekyll-algolia 1.2.5 → 1.2.7

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
  SHA1:
3
- metadata.gz: a03ae9ed115f3f1acce8a3388c2e1fc930e3c71f
4
- data.tar.gz: 02af7e8ad72b9bfa93b31201258d72c08aa3e57c
3
+ metadata.gz: 6243fd7aa41bd8a50531f03d81c2162ff2c0c8a1
4
+ data.tar.gz: 16da8529592e1cf701cce7781588486d41a11390
5
5
  SHA512:
6
- metadata.gz: 55d209c13e22c3dd81c7d5983a28339a9029298119e826ebf077d7a3b92d21ee73732aaabaa61744133a63c57d392796442458fb2521e334e8bdcbc7145bc868
7
- data.tar.gz: 881a872183278ac2c0325536c9a1e1892f2a8cd713cfd3b89a74e1f8a58065d972a22fec31d932223a94388ff23afe5d514678810fd4606bc554e4146fb0ddc0
6
+ metadata.gz: b95eb1944bca76b4fd0520f3f9ad6c29b0763c515dc0160edfb2a8e5086b9da1b9827741e258f5b27334efef4e49e4c86235dd02c2f8a4ad69f95b30dc254a2e
7
+ data.tar.gz: e40caac42d9d8793bc2d15025c0a3f017b9ee04235d84bfd4bb4fb2b6e392159edb7b290333752e373ec96931c7f3ef7ef7b46e2ea4ddeb1b3e826b16db262cb
@@ -250,16 +250,32 @@ module Jekyll
250
250
  nil
251
251
  end
252
252
 
253
+ # Public: Return true if the Jekyll default excerpt should be used for
254
+ # this file
255
+ #
256
+ # file - The Jekyll file
257
+ #
258
+ # Most of the time, we'll use our own excerpt (the first matching
259
+ # element), but in some cases, we'll fallback to Jekyll's default excerpt
260
+ # if it seems to be what the user wants
261
+ def self.use_default_excerpt?(file)
262
+ # Only posts can have excerpt
263
+ return false unless type(file) == 'post'
264
+
265
+ # User defined their own separator in the config
266
+ custom_separator = file.excerpt_separator.to_s.strip
267
+ return false if custom_separator.empty?
268
+
269
+ # This specific post contains this separator
270
+ file.content.include?(custom_separator)
271
+ end
272
+
253
273
  # Public: Returns the HTML version of the excerpt
254
274
  #
255
275
  # file - The Jekyll file
256
276
  def self.excerpt_html(file)
257
277
  # If it's a post with a custom separator for the excerpt, we honor it
258
- is_post = (type(file) == 'post')
259
- if is_post
260
- custom_separator = file.excerpt_separator.to_s.strip
261
- return excerpt_raw(file) unless custom_separator.empty?
262
- end
278
+ return excerpt_raw(file) if use_default_excerpt?(file)
263
279
 
264
280
  # Otherwise we take the first matching node
265
281
  html = file.content
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Algolia
5
- VERSION = '1.2.5'
5
+ VERSION = '1.2.7'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Carry