jekyll-algolia 1.2.4 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93a3fbb64cdc998714a77f4acef97d2c26e7d092
4
- data.tar.gz: a5a2352e2420398cd940a81b61585b9ac2aee2ee
3
+ metadata.gz: a03ae9ed115f3f1acce8a3388c2e1fc930e3c71f
4
+ data.tar.gz: 02af7e8ad72b9bfa93b31201258d72c08aa3e57c
5
5
  SHA512:
6
- metadata.gz: 07fc1126478460807bb1147b780d9a2db48cde5631a7ed3a5cb96f7e3db1e8bb5d0083feed67a6d56b579a04740be1f2d61d8afe927d0b807d456bfadf32ab59
7
- data.tar.gz: c6de2f07aaabd87a22b40d0f813c10fdb70b496cc360c12bed9b5fcfd2abaa0e20b0ceebda04679a37ea5a70efaf1267885791fae78ef86ccb5848fdcb840983
6
+ metadata.gz: 55d209c13e22c3dd81c7d5983a28339a9029298119e826ebf077d7a3b92d21ee73732aaabaa61744133a63c57d392796442458fb2521e334e8bdcbc7145bc868
7
+ data.tar.gz: 881a872183278ac2c0325536c9a1e1892f2a8cd713cfd3b89a74e1f8a58065d972a22fec31d932223a94388ff23afe5d514678810fd4606bc554e4146fb0ddc0
@@ -244,7 +244,7 @@ module Jekyll
244
244
  # error.
245
245
  def self.excerpt_raw(file)
246
246
  Logger.silent do
247
- return file.data['excerpt'].to_s
247
+ return file.data['excerpt'].to_s.strip
248
248
  end
249
249
  rescue StandardError
250
250
  nil
@@ -253,13 +253,20 @@ module Jekyll
253
253
  # Public: Returns the HTML version of the excerpt
254
254
  #
255
255
  # file - The Jekyll file
256
- #
257
- # Only collections (including posts) have an excerpt. Pages don't.
258
256
  def self.excerpt_html(file)
259
- excerpt = excerpt_raw(file)
260
- return nil if excerpt.nil?
261
- return nil if excerpt.empty?
262
- excerpt.to_s.tr("\n", ' ').strip
257
+ # 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
263
+
264
+ # Otherwise we take the first matching node
265
+ html = file.content
266
+ selector = Configurator.algolia('nodes_to_index')
267
+ first_node = Nokogiri::HTML(html).css(selector).first
268
+ return nil if first_node.nil?
269
+ first_node.to_s
263
270
  end
264
271
 
265
272
  # Public: Returns the text version of the excerpt
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Algolia
5
- VERSION = '1.2.4'
5
+ VERSION = '1.2.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Carry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-27 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: algolia_html_extractor