jekyll-webmention_io 2.8.5 → 2.9.0

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: 2b5797938c7edc67cf30f84ea7079aaf44293268
4
- data.tar.gz: d0d64fa0c5d4c4d9dce060e3f4499793caff3b13
3
+ metadata.gz: c67e6633b782bf90538bbd1da5a0ee6edc8c5d82
4
+ data.tar.gz: e43d1c4535118b448c5fd904792a576cb2582ff3
5
5
  SHA512:
6
- metadata.gz: 1571cab78b2e870e96f9ba8944a3ad7c2154e289b112c576d6feefd307aec0c58ab53ddbd5481609f83955216e2501809798539a049ee7ff7ac66f8cd43cde2a
7
- data.tar.gz: 54c195772469964258f051dcc4cd13780a1321d125940a407a26f0a48c59dfd83848c8851734a31069fe89c312baa60bc1ab2da82dc7d5309b411608dcb8cee4
6
+ metadata.gz: 022432117c194e4a4062c829faeb5ecf9d93814ffa8637f00181be95a97a66d981fa5a38ab2d2787a9ec343efeeb78edbc4ed4c0c2ee37edeb01749626040b08
7
+ data.tar.gz: 5d291d9f6daa5517ed4e5884988e64ff23f562b900682c177a9622451e79be23014c40862aca4a551d7756f46b292b0dddffb1aa49b0b2923e3d2ed537c743db
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  (function(window, document){
2
3
 
3
4
  // prerequisites
@@ -20,7 +21,7 @@
20
21
  // console.log( 'incoming webmentions', data.links );
21
22
  if ( data && ! ( 'error' in data ) )
22
23
  {
23
- webmentions = data.links.reverse();
24
+ var webmentions = data.links.reverse();
24
25
 
25
26
  webmentions = rationalizeIds( webmentions );
26
27
 
@@ -158,7 +159,11 @@
158
159
  webmention,
159
160
  incoming = {},
160
161
  queue_keys = Object.keys( webmention_receivers ),
161
- plural_type;
162
+ plural_type,
163
+ typeFilter = function(key) {
164
+ return JekyllWebmentionIO.types[key] === this.type;
165
+ },
166
+ typeFilterLoop;
162
167
 
163
168
  // set up the queues
164
169
  i = queue_keys.length;
@@ -169,14 +174,14 @@
169
174
 
170
175
  // Assign the webmentions to their respective queues
171
176
  i = webmentions.length;
177
+
172
178
  while ( i-- )
173
179
  {
174
180
  webmention = webmentions[i];
175
181
  // reverse lookup to get the plural from the singular
182
+ typeFilterLoop = typeFilter.bind(webmention);
176
183
  plural_type = Object.keys(JekyllWebmentionIO.types)
177
- .filter(function(key) {
178
- return JekyllWebmentionIO.types[key] === webmention.type;
179
- })[0];
184
+ .filter(typeFilterLoop)[0];
180
185
 
181
186
  // Is there a specific queue requesting this?
182
187
  if ( queue_keys.indexOf( plural_type ) > -1 )
@@ -320,8 +325,21 @@
320
325
 
321
326
  var i = webmentions.length,
322
327
  webmention,
323
- webmention_object;
324
-
328
+ webmention_object,
329
+ uri,
330
+ source,
331
+ pubdate,
332
+ type,
333
+ title,
334
+ content,
335
+ read = function( html_source ){
336
+ if ( html_source )
337
+ {
338
+ updateTitle( this.id, this.uri, html_source );
339
+ }
340
+ },
341
+ loop_read;
342
+
325
343
  while ( i-- )
326
344
  {
327
345
  webmention = webmentions[i];
@@ -394,16 +412,15 @@
394
412
  title = false;
395
413
  if ( type == 'post' )
396
414
  {
397
- readWebPage( uri, function( html_source ){
398
- if ( html_source )
399
- {
400
- updateTitle( webmention_object.id, uri, html_source );
401
- }
415
+ loop_read = read.bind({
416
+ id: webmention_object.id,
417
+ uri: uri
402
418
  });
419
+ readWebPage( uri, loop_read );
403
420
  }
404
421
 
405
422
  content = webmention.data.content;
406
- if ( type != 'post' && type != 'reply' && type != 'link' )
423
+ if ( type != 'bookmark' && type != 'link' && type != 'post' && type != 'reply' )
407
424
  {
408
425
  content = webmention.activity.sentence_html;
409
426
  }
@@ -460,7 +477,7 @@
460
477
  // cleanup
461
478
  title = title.replace( /<\/?[^>]+?>}/, '' );
462
479
  $link_title = document.createElement('a');
463
- $link_title.href = uri;
480
+ $link_title.href = url;
464
481
  $link_title.appendChild( document.createTextNode( title ) );
465
482
  // replace title contents
466
483
  $current_title.innerHTML = $link_title.outerHTML;
@@ -483,7 +500,7 @@
483
500
  callback( XHR.responseText );
484
501
  }
485
502
  };
486
- xhr.onabort = function() {
503
+ XHR.onabort = function() {
487
504
  if ( ! done )
488
505
  {
489
506
  done = true;
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  /**
2
3
  * WebMentions.io JS
3
4
  * A re-tooling of Aaron Parecki’s recommended JS for using the WebMention.io API
@@ -1,4 +1,5 @@
1
- ;(function(window, document){
1
+ // @ts-check
2
+ ;(function(window, document, JekyllWebmentionIO){
2
3
  'use strict';
3
4
 
4
5
  // prerequisites
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  (function(window, document){
2
3
 
3
4
  // prerequisites
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: false
2
+
1
3
  require "json"
2
4
 
3
5
  module Jekyll
@@ -19,31 +21,30 @@ module Jekyll
19
21
  count = 0
20
22
  cached_outgoing = Jekyll::WebmentionIO.get_cache_file_path "outgoing"
21
23
  if File.exist?(cached_outgoing)
22
- outgoing = open(cached_outgoing) { |f| YAML.safe_load(f) }
24
+ outgoing = open(cached_outgoing) { |f| YAML.load(f) }
23
25
  outgoing.each do |source, targets|
24
26
  targets.each do |target, response|
25
- next unless response === false
26
- if target.index("//") == 0
27
+ next unless response == false
28
+ if target.index("//").zero?
27
29
  target = "http:#{target}"
28
30
  end
29
31
  endpoint = Jekyll::WebmentionIO.get_webmention_endpoint(target)
30
32
  next unless endpoint
31
33
  response = Jekyll::WebmentionIO.webmention(source, target, endpoint)
32
- if response
33
- begin
34
- response = JSON.parse response
35
- rescue JSON::ParserError => e
36
- response = ''
37
- end
38
- outgoing[source][target] = response
39
- count += 1
34
+ next unless response
35
+ begin
36
+ response = JSON.parse response
37
+ rescue JSON::ParserError
38
+ response = ""
40
39
  end
40
+ outgoing[source][target] = response
41
+ count += 1
41
42
  end
42
43
  end
43
- if count > 0
44
+ if count.positive?
44
45
  File.open(cached_outgoing, "w") { |f| YAML.dump(outgoing, f) }
45
46
  end
46
- Jekyll::WebmentionIO.log "info", "#{count} webmentions sent."
47
+ Jekyll::WebmentionIO.log "msg", "#{count} webmentions sent."
47
48
  end # file exists (outgoing)
48
49
  end # def process
49
50
  end # WebmentionCommand
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: false
2
+
1
3
  # (c) Aaron Gustafson
2
4
  # https://github.com/aarongustafson/jekyll-webmention_io
3
5
  # Licence : MIT
@@ -26,7 +28,10 @@ module Jekyll
26
28
  priority :low
27
29
 
28
30
  def generate(site)
29
- if site.config.dig("webmentions", "js") == false
31
+ @site = site
32
+ @file_name = "JekyllWebmentionIO.js"
33
+
34
+ if @site.config.dig("webmentions", "js") == false
30
35
  Jekyll::WebmentionIO.log "info", "Skipping JavaScript inclusion."
31
36
  return
32
37
  end
@@ -35,19 +40,29 @@ module Jekyll
35
40
  "destination" => "js",
36
41
  "uglify" => true,
37
42
  }
38
- site_config = site.config.dig("webmentions", "js") || {}
39
-
43
+ site_config = @site.config.dig("webmentions", "js") || {}
40
44
  config = config.merge(site_config)
41
45
 
42
- source = File.expand_path("../assets/", __dir__)
46
+ @source_file_destination = (config["source"] == false ? Dir.mktmpdir : "#{@site.config["source"]}/#{config["destination"]}")
43
47
 
44
- javascript = ""
45
- Dir["#{source}/*.js"].each do |file|
46
- handler = File.open(file, "rb")
47
- javascript << File.read(handler)
48
+ @javascript = ""
49
+
50
+ concatenate_asset_files
51
+
52
+ add_webmention_types
53
+
54
+ unless config["uglify"] == false
55
+ uglify
56
+ end
57
+
58
+ create_js_file
59
+
60
+ unless config["deploy"] == false
61
+ deploy_js_file
48
62
  end
63
+ end
49
64
 
50
- # Dump in types
65
+ private def add_webmention_types
51
66
  js_types = []
52
67
  Jekyll::WebmentionIO.types.each do |type|
53
68
  js_types.push "'#{type}': '#{type.to_singular}'"
@@ -58,24 +73,32 @@ module Jekyll
58
73
  JekyllWebmentionIO.types = { TYPES };
59
74
  }(this, this.JekyllWebmentionIO));
60
75
  EOF
61
- javascript << types_js.sub(%r!TYPES!, js_types.join(","))
76
+ @javascript << types_js.sub(/TYPES/, js_types.join(","))
77
+ end
62
78
 
63
- unless config["uglify"] == false
64
- uglify_config = {
65
- :harmony => true,
66
- }
67
- javascript = Uglifier.new(uglify_config).compile(javascript)
79
+ private def concatenate_asset_files
80
+ source = File.expand_path("../assets/", __dir__)
81
+ Dir["#{source}/*.js"].each do |file|
82
+ handler = File.open(file, "rb")
83
+ @javascript << File.read(handler)
68
84
  end
85
+ end
69
86
 
70
- # Generate the file
71
- file_name = "JekyllWebmentionIO.js"
72
- source_file_destination = (config["source"] == false ? Dir.mktmpdir : "#{site.config["source"]}/#{config["destination"]}")
73
- Dir.mkdir(source_file_destination) unless File.exist?(source_file_destination)
74
- File.open("#{source_file_destination}/#{file_name}", "w") { |f| f.write(javascript) }
75
- unless config["deploy"] == false
76
- js_file = Jekyll::WebmentionIO::JavaScriptFile.new(site, source_file_destination, "", file_name)
77
- site.static_files << js_file
78
- end
87
+ private def uglify
88
+ uglify_config = {
89
+ :harmony => true,
90
+ }
91
+ @javascript = Uglifier.new(uglify_config).compile(@javascript)
92
+ end
93
+
94
+ private def create_js_file
95
+ Dir.mkdir(@source_file_destination) unless File.exist?(@source_file_destination)
96
+ File.open("#{@source_file_destination}/#{@file_name}", "w") { |f| f.write(@javascript) }
97
+ end
98
+
99
+ private def deploy_js_file
100
+ js_file = Jekyll::WebmentionIO::JavaScriptFile.new(@site, @source_file_destination, "", @file_name)
101
+ @site.static_files << js_file
79
102
  end
80
103
  end
81
104
  end
@@ -1,263 +1,148 @@
1
+ # frozen_string_literal: false
2
+
1
3
  # (c) Aaron Gustafson
2
- # https://github.com/aarongustafson/jekyll-webmention_io
4
+ # https://github.com/aarongustafson/jekyll-webmention_io
3
5
  # Licence : MIT
4
- #
6
+ #
5
7
  # This generator gathers webmentions of your pages
6
8
  #
7
9
 
10
+ require "time"
11
+
8
12
  module Jekyll
9
13
  class GatherWebmentions < Generator
10
-
11
14
  safe true
12
15
  priority :high
13
-
16
+
14
17
  def generate(site)
15
- if site.config.dig( 'webmentions', 'pause_lookups' ) == true
16
- Jekyll::WebmentionIO::log 'info', 'Webmention lookups are currently paused.'
18
+ @site = site
19
+
20
+ if @site.config.dig("webmentions", "pause_lookups") == true
21
+ Jekyll::WebmentionIO.log "msg", "Webmention lookups are currently paused."
17
22
  return
18
23
  end
19
24
 
20
- Jekyll::WebmentionIO::log 'info', 'Beginning to gather webmentions of your posts. This may take a while.'
21
-
22
- Jekyll::WebmentionIO::set_api_endpoint('mentions')
25
+ Jekyll::WebmentionIO.log "msg", "Beginning to gather webmentions of your posts. This may take a while."
26
+
27
+ Jekyll::WebmentionIO.api_path = "mentions"
23
28
  # add an arbitrarily high perPage to trump pagination
24
- Jekyll::WebmentionIO::set_api_suffix('&perPage=9999')
29
+ Jekyll::WebmentionIO.api_suffix = "&perPage=9999"
25
30
 
26
- cache_file = Jekyll::WebmentionIO::get_cache_file_path 'incoming'
27
- @cached_webmentions = open(cache_file) { |f| YAML.load(f) }
28
-
29
- if Jekyll::VERSION >= "3.0.0"
30
- posts = site.posts.docs
31
- else
32
- posts = site.posts
33
- end
31
+ @cached_webmentions = Jekyll::WebmentionIO.read_cached_webmentions "incoming"
34
32
 
35
- # post Jekyll commit 0c0aea3
36
- # https://github.com/jekyll/jekyll/commit/0c0aea3ad7d2605325d420a23d21729c5cf7cf88
37
- if defined? site.find_converter_instance
38
- @converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
39
- # Prior to Jekyll commit 0c0aea3
40
- else
41
- @converter = site.getConverterImpl(::Jekyll::Converters::Markdown)
42
- end
43
-
33
+ posts = Jekyll::WebmentionIO.gather_documents(@site)
44
34
  posts.each do |post|
45
- # get the last webmention
46
- last_webmention = @cached_webmentions.dig( post.url, @cached_webmentions.dig( post.url )&.keys&.last )
47
-
48
- # should we throttle?
49
- if last_webmention && Jekyll::WebmentionIO::post_should_be_throttled?( post, post.date, last_webmention.dig( 'raw', 'verified_date' ) )
50
- # Jekyll::WebmentionIO::log 'info', "Throttling #{post.url}"
51
- next
35
+ check_for_webmentions(post)
36
+ end
37
+
38
+ Jekyll::WebmentionIO.cache_webmentions "incoming", @cached_webmentions
39
+ end # generate
40
+
41
+ private
42
+
43
+ def check_for_webmentions(post)
44
+ Jekyll::WebmentionIO.log "info", "Checking for webmentions of #{post.url}."
45
+
46
+ # get the last webmention
47
+ last_webmention = @cached_webmentions.dig(post.url, @cached_webmentions.dig(post.url)&.keys&.last)
48
+
49
+ # should we throttle?
50
+ if post.respond_to? "date" # Some docs have no date
51
+ if last_webmention && Jekyll::WebmentionIO.post_should_be_throttled?(post, post.date, last_webmention.dig("raw", "verified_date"))
52
+ Jekyll::WebmentionIO.log "info", "Throttling this post."
53
+ return
52
54
  end
55
+ end
53
56
 
54
- # past_webmentions.dig( past_webmentions&.keys&.last )
55
- # past_webmentions[past_webmentions.keys.last]['raw']['verified_date']
57
+ # Get the last id we have in the hash
58
+ since_id = last_webmention ? last_webmention.dig("raw", "id") : false
56
59
 
57
- # Get the last id we have in the hash
58
- since_id = last_webmention ? last_webmention.dig( 'raw', 'id' ) : false
59
-
60
- # Gather the URLs
61
- targets = get_webmention_target_urls(site, post)
60
+ # Gather the URLs
61
+ targets = get_webmention_target_urls(post)
62
62
 
63
- # execute the API
64
- api_params = targets.collect { |v| "target[]=#{v}" }.join('&')
65
- api_params << "&since_id=#{since_id}" if since_id
66
- response = Jekyll::WebmentionIO::get_response(api_params)
67
- # Jekyll::WebmentionIO::log "info", response.inspect
68
-
69
- process_webmentions( post.url, response )
70
- end # posts loop
63
+ # execute the API
64
+ response = Jekyll::WebmentionIO.get_response assemble_api_params(targets, since_id)
65
+ webmentions = response.dig("links")
66
+ if webmentions && !webmentions.empty?
67
+ Jekyll::WebmentionIO.log "info", "Here’s what we got back:\n\n#{response.inspect}\n\n"
68
+ else
69
+ Jekyll::WebmentionIO.log "info", "No webmentions found."
70
+ end
71
71
 
72
- File.open(cache_file, 'w') { |f| YAML.dump(@cached_webmentions, f) }
73
-
74
- Jekyll::WebmentionIO::log 'info', 'Webmentions have been gathered and cached.'
75
- end # generate
72
+ cache_new_webmentions(post.url, response)
73
+ end
76
74
 
77
- def get_webmention_target_urls(site, post)
75
+ def get_webmention_target_urls(post)
78
76
  targets = []
79
- uri = "#{site.config['url']}#{post.url}"
80
- targets.push( uri )
81
-
77
+ base_uri = @site.config["url"].chomp("/")
78
+ uri = "#{base_uri}#{post.url}"
79
+ targets.push(uri)
80
+
82
81
  # Redirection?
82
+ gather_redirected_targets(post, uri, targets)
83
+
84
+ # Domain changed?
85
+ gather_legacy_targets(uri, targets)
86
+
87
+ targets
88
+ end
89
+
90
+ def gather_redirected_targets(post, uri, targets)
83
91
  redirected = false
84
- if post.data.has_key? 'redirect_from'
85
- if post.data['redirect_from'].is_a? String
86
- redirected = uri.sub post.url, post.data['redirect_from']
87
- targets.push( redirected )
88
- elsif post.data['redirect_from'].is_a? Array
89
- post.data['redirect_from'].each do |redirect|
92
+ if post.data.key? "redirect_from"
93
+ if post.data["redirect_from"].is_a? String
94
+ redirected = uri.sub post.url, post.data["redirect_from"]
95
+ targets.push(redirected)
96
+ elsif post.data["redirect_from"].is_a? Array
97
+ post.data["redirect_from"].each do |redirect|
90
98
  redirected = uri.sub post.url, redirect
91
- targets.push( redirected )
92
- end
99
+ targets.push(redirected)
100
+ end
93
101
  end
94
102
  end
95
-
96
- # Domain changed?
97
- if Jekyll::WebmentionIO::config.has_key? 'legacy_domains'
98
- # Jekyll::WebmentionIO::log 'info', 'adding legacy URIs'
99
- Jekyll::WebmentionIO::config['legacy_domains'].each do |domain|
100
- legacy = uri.sub site.config['url'], domain
101
- # Jekyll::WebmentionIO::log 'info', "adding URI #{legacy}"
103
+ end
104
+
105
+ def gather_legacy_targets(uri, targets)
106
+ if Jekyll::WebmentionIO.config.key? "legacy_domains"
107
+ Jekyll::WebmentionIO.log "info", "adding legacy URIs"
108
+ Jekyll::WebmentionIO.config["legacy_domains"].each do |domain|
109
+ legacy = uri.sub @site.config["url"], domain
110
+ Jekyll::WebmentionIO.log "info", "adding URI #{legacy}"
102
111
  targets.push(legacy)
103
112
  end
104
113
  end
105
- return targets
106
114
  end
107
115
 
108
- def markdownify( string )
109
- string = @converter.convert("#{string}")
110
- if ! string.start_with?('<p')
111
- string = string.sub(/^<[^>]+>/, '<p>').sub(/<\/[^>]+>$/, '</p>')
112
- end
113
- string.strip
116
+ def assemble_api_params(targets, since_id)
117
+ api_params = targets.collect { |v| "target[]=#{v}" }.join("&")
118
+ api_params << "&since_id=#{since_id}" if since_id
119
+ api_params << "&sort-by=published"
120
+ api_params
114
121
  end
115
122
 
116
- def process_webmentions( post_uri, response )
117
-
123
+ def cache_new_webmentions(post_uri, response)
118
124
  # Get cached webmentions
119
- if @cached_webmentions.has_key? post_uri
120
- webmentions = @cached_webmentions[post_uri]
121
- else
122
- webmentions = {}
123
- end
125
+ webmentions = if @cached_webmentions.key? post_uri
126
+ @cached_webmentions[post_uri]
127
+ else
128
+ {}
129
+ end
124
130
 
125
- if response and response['links']
126
-
127
- response['links'].reverse_each do |link|
128
-
129
- uri = link['data']['url'] || link['source']
130
-
131
- # set the source
132
- source = false
133
- if uri.include? 'twitter.com/'
134
- source = 'twitter'
135
- elsif uri.include? '/googleplus/'
136
- source = 'googleplus'
137
- end
138
-
139
- # set an id
140
- id = link['id'].to_s
141
- if source == 'twitter' and ! uri.include? '#favorited-by'
142
- id = URI(uri).path.split('/').last.to_s
143
- end
144
- if ! id
145
- time = Time.now();
146
- id = time.strftime('%s').to_s
147
- end
131
+ if response && response["links"]
132
+ response["links"].reverse_each do |link|
133
+ webmention = Jekyll::WebmentionIO::Webmention.new(link, @site)
148
134
 
149
135
  # Do we already have it?
150
- if webmentions.has_key? id
136
+ if webmentions.key? webmention.id
151
137
  next
152
138
  end
153
139
 
154
- # Get the mentioned URI, stripping fragments and query strings
155
- #target = URI::parse( link['target'] )
156
- #target.fragment = target.query = nil
157
- #target = target.to_s
158
-
159
- pubdate = link['data']['published_ts']
160
- if pubdate
161
- pubdate = Time.at(pubdate)
162
- elsif link['verified_date']
163
- pubdate = Time.parse(link['verified_date'])
164
- end
165
- #the_date = pubdate.strftime('%s')
166
-
167
- # Make sure we have the date
168
- # if ! webmentions.has_key? the_date
169
- # webmentions[the_date] = {}
170
- # end
171
-
172
- # Make sure we don’t have the webmention
173
- unless webmentions.has_key? id
174
-
175
- # Scaffold the webmention
176
- webmention = {
177
- 'id' => id,
178
- 'url' => uri,
179
- 'source' => source,
180
- 'pubdate' => pubdate,
181
- 'raw' => link
182
- }
183
-
184
- # Set the author
185
- if link['data'].has_key? 'author'
186
- webmention['author'] = link['data']['author']
187
- end
188
-
189
- # Set the type
190
- type = link['activity']['type']
191
- if ! type
192
- if source == 'googleplus'
193
- if uri.include? '/like/'
194
- type = 'like'
195
- elsif uri.include? '/repost/'
196
- type = 'repost'
197
- elsif uri.include? '/comment/'
198
- type = 'reply'
199
- else
200
- type = 'link'
201
- end
202
- else
203
- type = 'post'
204
- end
205
- end # if no type
206
- webmention['type'] = type
207
-
208
- # Posts
209
- title = false
210
- if type == 'post'
211
-
212
- html_source = Jekyll::WebmentionIO::get_uri_source( uri )
213
- if ! html_source
214
- next
215
- end
216
-
217
- if ! html_source.valid_encoding?
218
- html_source = html_source.encode('UTF-16be', :invalid=>:replace, :replace=>"?").encode('UTF-8')
219
- end
220
-
221
- # Check the `title` first
222
- matches = /<title>(.*)<\/title>/.match( html_source )
223
- if matches
224
- title = matches[1].strip
225
- else
226
- # Fall back to the first `h1`
227
- matches = /<h1>(.*)<\/h1>/.match( html_source )
228
- if matches
229
- title = matches[1].strip
230
- else
231
- # No title found
232
- title = 'No title available'
233
- end
234
- end
235
-
236
- # cleanup
237
- title = title.gsub(%r{</?[^>]+?>}, '')
238
- end # if no title
239
- webmention['title'] = markdownify( title ) if title
240
-
241
- # Everything else
242
- content = link['activity']['sentence_html']
243
- if ['post', 'reply', 'link'].include? type
244
- content = link['data']['content'] if link.dig( 'data', 'content' )
245
- end
246
- webmention['content'] = markdownify( content )
247
-
248
- # Add it to the list
249
- # @webmention_io.log 'info', webmention.inspect
250
- webmentions[id] = webmention
251
-
252
- end # Make sure we don’t have the webmention
253
-
140
+ # Add it to the list
141
+ Jekyll::WebmentionIO.log "info", webmention.to_hash.inspect
142
+ webmentions[webmention.id] = webmention.to_hash
254
143
  end # each link
255
-
256
144
  end # if response
257
-
258
145
  @cached_webmentions[post_uri] = webmentions
259
-
260
146
  end # process_webmentions
261
-
262
147
  end
263
- end
148
+ end