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 +4 -4
- data/lib/jekyll/algolia/file_browser.rb +21 -5
- data/lib/jekyll/algolia/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6243fd7aa41bd8a50531f03d81c2162ff2c0c8a1
|
4
|
+
data.tar.gz: 16da8529592e1cf701cce7781588486d41a11390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|