jekyll-stickyposts 1.2.0 → 1.2.1

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: d365b436e02b062efc4b2adcf1bf15a4621b1450
4
- data.tar.gz: b517e5b9dc946b3cc0660df2ee0abe8f206193e5
3
+ metadata.gz: be51434121b3596109ea4476f0c9b24cfa5bd503
4
+ data.tar.gz: f14b96fddc2097c5b25a196ed63f7ce60b43dddb
5
5
  SHA512:
6
- metadata.gz: ad2096bbfa81d961c8b6b35869c24cbd2ae8c8f84a8ed24f1bbe8c97033985635e2b1cc391ba44451000c10475da47a29728d74b19c4cb29fe348bd101369220
7
- data.tar.gz: a772dd9eb0c676ba4fd0abc9f3c662138261e73133f7383957895699f4a9714acfab3113b4d93e4b6510accbe33e9392925e0063d1b087106cc847a2e17a1d98
6
+ metadata.gz: 7efbd0f07966d7ce235825562692c041f67a228c03c3c1923361642d1efd05bd598260bf2581f97485a92d679bcbbd3fdb14b5c0370c7d08a9a3e723a99f048d
7
+ data.tar.gz: 45080989ab2ef724fe13eadf0b34c64f26b32c82493dc3a232e023be6575f9b6606fb5c557a9765f704c4aa7ceace1b38ca3f52668d215a249853b30517c523e
data/.gitignore CHANGED
@@ -7,6 +7,13 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ # Swap
11
+ [._]*.s[a-v][a-z]
12
+ [._]*.sw[a-p]
13
+ [._]s[a-v][a-z]
14
+ [._]sw[a-p]
15
+ Session.vim
16
+
10
17
  # rspec failure tracking
11
18
  .rspec_status
12
19
  jekyll-stickyposts*.gem
@@ -10,8 +10,8 @@ module Jekyll
10
10
  Jekyll.logger.info "StickyPosts:", msg
11
11
  end
12
12
 
13
- def self.debug(msg)
14
- self.info msg if @debug
13
+ def self.debug(msg, doc = nil)
14
+ self.info msg if @debug && (doc.nil? || !doc.data['autogen_page'])
15
15
  end
16
16
 
17
17
  class Generator < Jekyll::Generator
@@ -46,20 +46,18 @@ module Jekyll
46
46
 
47
47
  unless config["sort"] == "none"
48
48
  sorted.sort! { |docB, docA|
49
- a = docA.data[sort_field]
50
- b = docB.data[sort_field]
49
+ a = sort_value(docA.data, sort_field)
50
+ b = sort_value(docB.data, sort_field)
51
51
 
52
52
  if a.nil? && !b.nil?
53
53
  -1
54
54
  elsif !a.nil? && b.nil?
55
55
  1
56
- end
57
-
58
- if a.respond_to?('to_datetime') && b.respond_to?('to_datetime')
56
+ elsif a.respond_to?('to_datetime') && b.respond_to?('to_datetime')
59
57
  a.to_datetime <=> b.to_datetime
58
+ else
59
+ a <=> b
60
60
  end
61
-
62
- a <=> b
63
61
  }
64
62
 
65
63
  sorted.reverse! if sort_reverse
@@ -70,7 +68,7 @@ module Jekyll
70
68
  sticky = []
71
69
  sorted.delete_if do |doc|
72
70
  if doc.data['sticky']
73
- StickyPosts::debug "\"#{doc.data['title']}\" is sticky, #{remove ? "removing" : "retaining"} copy"
71
+ StickyPosts::debug "\"#{doc.data['title']}\" is sticky; #{remove ? "removing" : "retaining"} copy", doc
74
72
  if remove
75
73
  sticky << doc
76
74
  else
@@ -95,6 +93,18 @@ module Jekyll
95
93
  StickyPosts::info "[#{collection}] #{sticky.length} post(s) pinned"
96
94
  end
97
95
  end
96
+
97
+ private
98
+ def sort_value(data, path)
99
+ value = data
100
+
101
+ path.split(":").each do |key|
102
+ return nil unless value = value[key.downcase.strip]
103
+ end
104
+
105
+ value.is_a?(Hash) ? nil : value
106
+ end
107
+
98
108
  end
99
109
  end
100
110
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module StickyPosts
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-stickyposts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Ibrado
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll