jekyll-webmention_io 2.6.2 → 2.6.3

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: 5d86bfdab4d69fd069fa99d6fea826e339ec4d8f
4
- data.tar.gz: cea42253a16bda0f67f61906f6c287e68a1ecc69
3
+ metadata.gz: 34469c6b4a37c2117e85ee46589880aeddab27e3
4
+ data.tar.gz: 5188a0aad200b94ce371cf45abe972cd3eb4f41f
5
5
  SHA512:
6
- metadata.gz: 03f80512f3cba8a20568f96711056d0656cdef74cd4571e74353c35e2b6b8950725b18a7451f985273bdc6f721a1a2b1ecaa700ad6f755d677faa3da3cf3cda6
7
- data.tar.gz: '08592dfefc41d220c6d15ed293d3fbaa3131e8eb8654a3608eb070f3b1effe2e2af69ebcee9ddff61a2076bdd99fdcc218fdd582fd7eec7b064b0697f29bf419'
6
+ metadata.gz: 2a55f6a92d741ee73c2c0b14222aafc70383f05c856f4c5755328bdc39a75ae132bb5d0a74788e4e82391401feb33ed8f35e0158ea36a775a6affc6ad48c5893
7
+ data.tar.gz: a2c23a460f6e897449d4b6bfac555a646a6d5342278d8d865d89082b3c1f35da5fc4b02873515a29aa31cba549d29bc88dd14bcac8c7266e034f931ec9ff1007
@@ -27,7 +27,7 @@ module Jekyll
27
27
  priority :low
28
28
 
29
29
  def generate(site)
30
- if site.config['webmentions']['js'] == false
30
+ if site.config.dig( 'webmentions', 'js' ) == false
31
31
  Jekyll::WebmentionIO::log 'info', 'Skipping JavaScript inclusion.'
32
32
  return
33
33
  end
@@ -36,7 +36,7 @@ module Jekyll
36
36
  'destination' => 'js',
37
37
  'uglify' => true
38
38
  }
39
- site_config = site.config['webmentions']['js'] || {}
39
+ site_config = site.config.dig( 'webmentions', 'js' ) || {}
40
40
 
41
41
  config = config.merge(site_config)
42
42
 
@@ -12,7 +12,7 @@ module Jekyll
12
12
  priority :high
13
13
 
14
14
  def generate(site)
15
- if site.config['webmentions']['pause_lookups'] == true
15
+ if site.config.dig( 'webmentions', 'pause_lookups' ) == true
16
16
  Jekyll::WebmentionIO::log 'info', 'Webmention lookups are currently paused.'
17
17
  return
18
18
  end
@@ -49,7 +49,7 @@ module Jekyll
49
49
  since_id = false
50
50
  if @cached_webmentions.has_key? post.url
51
51
  past_webmentions = @cached_webmentions[post.url]
52
- if past_webmentions && past_webmentions.keys && past_webmentions[past_webmentions.keys.last]
52
+ if past_webmentions.dig( past_webmentions&.keys&.last )
53
53
  since_id = past_webmentions[past_webmentions.keys.last]['raw']['id']
54
54
  end
55
55
  end
@@ -233,9 +233,9 @@ module Jekyll
233
233
  webmention['title'] = markdownify( title ) if title
234
234
 
235
235
  # Everything else
236
- content = link['data']['content']
237
- if type != 'post' && type != 'reply' && type != 'link'
238
- content = link['activity']['sentence_html']
236
+ content = link['activity']['sentence_html']
237
+ if ['post', 'reply', 'link'].include? type
238
+ content = link['data']['content'] unless link['data']['content'].empty?
239
239
  end
240
240
  webmention['content'] = markdownify( content )
241
241
 
@@ -12,7 +12,7 @@ module Jekyll
12
12
  priority :low
13
13
 
14
14
  def generate(site)
15
- if site.config['webmentions']['pause_lookups'] == true
15
+ if site.config.dig( 'webmentions', 'pause_lookups' ) == true
16
16
  Jekyll::WebmentionIO::log 'info', 'Webmention lookups are currently paused.'
17
17
  return
18
18
  end
@@ -62,7 +62,7 @@ module Jekyll
62
62
  outgoing_webmentions.each do |source_url, webmentions|
63
63
  collection = {}
64
64
  webmentions.each do |target_url|
65
- if sent_webmentions.has_key? source_url and sent_webmentions[source_url].include? target_url
65
+ if sent_webmentions.dig( source_url, target_url )
66
66
  collection[target_url] = ""
67
67
  else
68
68
  collection[target_url] = false
data/lib/jekyll/tags/_.rb CHANGED
@@ -31,21 +31,9 @@ module Jekyll
31
31
  end
32
32
 
33
33
  def set_template( template )
34
- supported_templates = Jekyll::WebmentionIO::types + ['count', 'webmentions']
35
-
34
+ supported_templates = Jekyll::WebmentionIO::types + ['count', 'webmentions']
36
35
  Jekyll::WebmentionIO::log 'error', "#{template} is not supported" if ! supported_templates.include? template
37
-
38
- if Jekyll::WebmentionIO::config.has_key? 'templates' and Jekyll::WebmentionIO::config['templates'].has_key? template
39
- # Jekyll::WebmentionIO::log 'info', "Using custom #{template} template"
40
- template_file = Jekyll::WebmentionIO::config['templates'][template]
41
- else
42
- # Jekyll::WebmentionIO::log 'info', "Using default #{template} template"
43
- template_file = File.join(File.dirname(File.expand_path(__FILE__)), "../templates/#{template}.html")
44
- end
45
-
46
- # Jekyll::WebmentionIO::log 'info', "Template file: #{template_file}"
47
- handler = File.open(template_file, 'rb')
48
- @template = handler.read
36
+ @template = Jekyll::WebmentionIO::get_template_contents( template )
49
37
  # Jekyll::WebmentionIO::log 'info', "template: #{@template}"
50
38
  end
51
39
 
@@ -25,4 +25,5 @@ module Jekyll
25
25
  end
26
26
  end
27
27
 
28
- Liquid::Template.register_tag('webmention_count', Jekyll::WebmentionIO::WebmentionCountTag)
28
+ Liquid::Template.register_tag('webmention_count', Jekyll::WebmentionIO::WebmentionCountTag)
29
+ Liquid::Template.register_tag('webmentions_count', Jekyll::WebmentionIO::WebmentionCountTag)
@@ -25,10 +25,10 @@ module Jekyll
25
25
  head << "<meta property=\"webmention:redirected_from\" content=\"#{redirect}\">"
26
26
  end
27
27
 
28
- config = site.config['webmentions']
29
- if config.has_key? 'username'
30
- head << "<link rel=\"pingback\" href=\"https://webmention.io/#{config['username']}/xmlrpc\">"
31
- head << "<link rel=\"webmention\" href=\"https://webmention.io/#{config['username']}/webmention\">"
28
+ username = site.config.dig( 'webmentions', 'username' )
29
+ if username
30
+ head << "<link rel=\"pingback\" href=\"https://webmention.io/#{username}/xmlrpc\">"
31
+ head << "<link rel=\"webmention\" href=\"https://webmention.io/#{username}/webmention\">"
32
32
  end
33
33
 
34
34
  head
@@ -12,15 +12,16 @@ module Jekyll
12
12
  site = context.registers[:site]
13
13
 
14
14
  # JS can be turned off too
15
- if site.config['webmentions']['js'] == false
16
- return
15
+ if site.config.dig( 'webmentions', 'js' ) == false
16
+ Jekyll::WebmentionIO::log 'info', 'JavaScript output is disabled, so the {% webmentions_js %} tag is being skipped'
17
+ return ''
17
18
  end
18
19
 
19
20
  config = {
20
- 'destination' => "js",
21
+ 'destination' => 'js',
21
22
  'uglify' => true
22
23
  }
23
- site_config = site.config['webmentions']['js'] || {}
24
+ site_config = site.config.dig( 'webmentions', 'js' ) || {}
24
25
  config = config.merge(site_config)
25
26
 
26
27
  # JS file
@@ -33,18 +34,9 @@ module Jekyll
33
34
  templates = ''
34
35
  template_files = Jekyll::WebmentionIO::types + ['count', 'webmentions']
35
36
  template_files.each do |template|
36
- if Jekyll::WebmentionIO::config.has_key? 'templates' and Jekyll::WebmentionIO::config['templates'].has_key? template
37
- # Jekyll::WebmentionIO::log 'info', "Using custom #{template} template"
38
- template_file = Jekyll::WebmentionIO::config['templates'][template]
39
- else
40
- # Jekyll::WebmentionIO::log 'info', "Using default #{template} template"
41
- template_file = File.join(File.dirname(File.expand_path(__FILE__)), "../templates/#{template}.html")
42
- end
43
- # Jekyll::WebmentionIO::log 'info', "Template file: #{template_file}"
44
- handler = File.open(template_file, 'rb')
45
- template_contents = handler.read
46
-
47
- templates << "<template style=\"display:none\" id=\"webmention-#{template}\">#{template_contents}</template>"
37
+ templates << "<template style=\"display:none\" id=\"webmention-#{template}\">"
38
+ templates << Jekyll::WebmentionIO::get_template_contents( template )
39
+ templates << '</template>'
48
40
  end
49
41
 
50
42
  "#{js}\n#{templates}"
@@ -123,6 +123,19 @@ module Jekyll
123
123
  response
124
124
  end
125
125
 
126
+ def self.get_template_contents( template )
127
+ if Jekyll::WebmentionIO::config.dig( 'templates', template )
128
+ # Jekyll::WebmentionIO::log 'info', "Using custom #{template} template"
129
+ template_file = Jekyll::WebmentionIO::config['templates'][template]
130
+ else
131
+ # Jekyll::WebmentionIO::log 'info', "Using default #{template} template"
132
+ template_file = File.join(File.dirname(File.expand_path(__FILE__)), "templates/#{template}.html")
133
+ end
134
+ # Jekyll::WebmentionIO::log 'info', "Template file: #{template_file}"
135
+ handler = File.open(template_file, 'rb')
136
+ handler.read
137
+ end
138
+
126
139
  # Utilities
127
140
  # def key_exists(hash, test_key)
128
141
  # if hash.is_a? Hash
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module WebmentionIO
3
- VERSION = "2.6.2"
3
+ VERSION = "2.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-webmention_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Gustafson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-01 00:00:00.000000000 Z
11
+ date: 2017-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -201,12 +201,16 @@ dependencies:
201
201
  description: |
202
202
  This Gem includes a suite of tools for managing webmentions in Jekyll:
203
203
 
204
- * Tags - render webmention info into your templates:
205
- ** All webmentions
206
- ** Count of webmentions
207
- ** Likes
208
- ** Replies
209
- ** Reposts
204
+ * Tags
205
+ * Count of webmentions (filterable)
206
+ * All webmentions (filterable)
207
+ * Likes
208
+ * Links
209
+ * Posts
210
+ * Replies
211
+ * Reposts
212
+ * Contents for the `head` of your pages
213
+ * JavaScript enhancements
210
214
  * Commands - Send webmentions you’ve made
211
215
  * Generators - Collect webmentions from Webmention.io and gather sites you’ve mentioned
212
216
  email: