jekyll-webmention_io 2.0.8 → 2.0.9

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: d80a14515f3a82873ca94fffb37abd49b2d9332c
4
- data.tar.gz: eaa0b2f847af6fc1be80e81d4942d404a56ce5d5
3
+ metadata.gz: 10c4de12f753eb0089ea97d4f6f4d6eb31331b54
4
+ data.tar.gz: 543d88d8d727574fb0e237586279b46d219d5468
5
5
  SHA512:
6
- metadata.gz: 3a423098f9664be181b8c6400092975f1af73e832f81fca849a38a9d04ef2756adfe00d179b3871528591eab49f6a30844c37aaa51ca34f3fa1d424de607b67d
7
- data.tar.gz: 1ee9db5d869fe89efcc9aae3d3eadabb061092254f259f5860a00804309fd1813c562ea6981a69fa47d78240a5b965d2295ccc1402c69e080787d68d2244afc3
6
+ metadata.gz: 6e52aa4796d105c11ec3236eb7bd5b7cd6066b1fa436806858d11b456612d58ad426818731d6761ecc75802ea39b830251a36065f8da96fe653acd4665d220f8
7
+ data.tar.gz: 3797235cbbca4a0abae1264235d98030f868bce8014f1677a3f1fccf3ab8706d83e6d74a90d9c05c3973df77f6a004b67804237c7fed2753b2273f472a96ba43
File without changes
@@ -11,8 +11,8 @@ module Jekyll
11
11
  end
12
12
 
13
13
  def self.process( args=[], options={} )
14
- cached_outgoing = WebmentionIO.get_cache_file_path 'outgoing'
15
- cached_sent = WebmentionIO.get_cache_file_path 'sent'
14
+ cached_outgoing = Jekyll::WebmentionIO::get_cache_file_path 'outgoing'
15
+ cached_sent = Jekyll::WebmentionIO::get_cache_file_path 'sent'
16
16
  if File.exists?(cached_outgoing)
17
17
  if File.exists?(cached_sent)
18
18
  sent = open(cached_sent) { |f| YAML.load(f) }
@@ -29,11 +29,11 @@ module Jekyll
29
29
  if target.index( "//" ) == 0
30
30
  target = "http:#{target}"
31
31
  end
32
- endpoint = WebmentionIO.get_webmention_endpoint( target )
32
+ endpoint = Jekyll::WebmentionIO::get_webmention_endpoint( target )
33
33
  if endpoint
34
34
  endpoint.scan(/href="([^"]+)"/) do |endpoint_url|
35
35
  endpoint_url = endpoint_url[0]
36
- WebmentionIO.webmention( source, target, endpoint )
36
+ Jekyll::WebmentionIO::webmention( source, target, endpoint )
37
37
  end
38
38
  sent[source].push( target )
39
39
  end
@@ -12,13 +12,13 @@ module Jekyll
12
12
  priority :high
13
13
 
14
14
  def generate(site)
15
- WebmentionIO.log 'info', 'Beginning to gather webmentions of your posts. This may take a while.'
15
+ Jekyll::WebmentionIO::log 'info', 'Beginning to gather webmentions of your posts. This may take a while.'
16
16
 
17
- WebmentionIO.set_api_endpoint('mentions')
17
+ Jekyll::WebmentionIO::set_api_endpoint('mentions')
18
18
  # add an arbitrarily high perPage to trump pagination
19
- WebmentionIO.set_api_suffix('&perPage=9999')
19
+ Jekyll::WebmentionIO::set_api_suffix('&perPage=9999')
20
20
 
21
- cache_file = WebmentionIO.get_cache_file_path 'incoming'
21
+ cache_file = Jekyll::WebmentionIO::get_cache_file_path 'incoming'
22
22
  if File.exists?(cache_file)
23
23
  @cached_webmentions = open(cache_file) { |f| YAML.load(f) }
24
24
  else
@@ -46,7 +46,7 @@ module Jekyll
46
46
 
47
47
  # execute the API
48
48
  api_params = targets.collect { |v| "target[]=#{v}" }.join('&')
49
- response = WebmentionIO.get_response(api_params)
49
+ response = Jekyll::WebmentionIO::get_response(api_params)
50
50
  # @webmention_io.log 'info', response.inspect
51
51
 
52
52
  process_webmentions( post.url, response )
@@ -54,7 +54,7 @@ module Jekyll
54
54
 
55
55
  File.open(cache_file, 'w') { |f| YAML.dump(@cached_webmentions, f) }
56
56
 
57
- WebmentionIO.log 'info', 'Webmentions have been gathered and cached.'
57
+ Jekyll::WebmentionIO::log 'info', 'Webmentions have been gathered and cached.'
58
58
  end # generate
59
59
 
60
60
  def get_webmention_target_urls(site, post)
@@ -70,11 +70,11 @@ module Jekyll
70
70
  end
71
71
 
72
72
  # Domain changed?
73
- if WebmentionIO.config.has_key? 'legacy_domains'
74
- # WebmentionIO.log 'info', 'adding legacy URIs'
75
- WebmentionIO.config['legacy_domains'].each do |domain|
73
+ if Jekyll::WebmentionIO::config.has_key? 'legacy_domains'
74
+ # Jekyll::WebmentionIO::log 'info', 'adding legacy URIs'
75
+ Jekyll::WebmentionIO::config['legacy_domains'].each do |domain|
76
76
  legacy = uri.sub site.config['url'], domain
77
- # WebmentionIO.log 'info', "adding URI #{legacy}"
77
+ # Jekyll::WebmentionIO::log 'info', "adding URI #{legacy}"
78
78
  targets.push(legacy)
79
79
  end
80
80
  end
@@ -185,7 +185,7 @@ module Jekyll
185
185
  title = false
186
186
  if type == 'post'
187
187
 
188
- html_source = WebmentionIO.get_uri_source( uri )
188
+ html_source = Jekyll::WebmentionIO::get_uri_source( uri )
189
189
  if ! html_source
190
190
  next
191
191
  end
@@ -12,7 +12,7 @@ module Jekyll
12
12
  priority :low
13
13
 
14
14
  def generate(site)
15
- WebmentionIO.log 'info', 'Beginning to gather webmentions you’ve made. This may take a while.'
15
+ Jekyll::WebmentionIO::log 'info', 'Beginning to gather webmentions you’ve made. This may take a while.'
16
16
 
17
17
  webmentions = {}
18
18
 
@@ -27,10 +27,10 @@ module Jekyll
27
27
  webmentions[uri] = get_mentioned_uris(post)
28
28
  end
29
29
 
30
- cache_file = WebmentionIO.get_cache_file_path 'outgoing'
30
+ cache_file = Jekyll::WebmentionIO::get_cache_file_path 'outgoing'
31
31
  File.open(cache_file, 'w') { |f| YAML.dump(webmentions, f) }
32
32
 
33
- WebmentionIO.log 'info', 'Webmentions have been gathered and cached.'
33
+ Jekyll::WebmentionIO::log 'info', 'Webmentions have been gathered and cached.'
34
34
  end
35
35
 
36
36
  def get_mentioned_uris(post)
data/lib/jekyll/tags/_.rb CHANGED
@@ -8,124 +8,126 @@
8
8
  require 'htmlbeautifier'
9
9
 
10
10
  module Jekyll
11
- using StringInflection
12
- class WebmentionTag < Liquid::Tag
13
-
14
- def initialize(tagName, text, tokens)
15
- super
16
- cache_file = WebmentionIO.get_cache_file_path 'incoming'
17
- if File.exists?(cache_file)
18
- @cached_webmentions = open(cache_file) { |f| YAML.load(f) }
19
- else
20
- @cached_webmentions = {}
11
+ module WebmentionIO
12
+ using StringInflection
13
+ class WebmentionTag < Liquid::Tag
14
+
15
+ def initialize(tagName, text, tokens)
16
+ super
17
+ cache_file = Jekyll::WebmentionIO::get_cache_file_path 'incoming'
18
+ if File.exists?(cache_file)
19
+ @cached_webmentions = open(cache_file) { |f| YAML.load(f) }
20
+ else
21
+ @cached_webmentions = {}
22
+ end
21
23
  end
22
- end
23
24
 
24
- def lookup(context, name)
25
- lookup = context
26
- name.split(".").each do |value|
27
- lookup = lookup[value]
25
+ def lookup(context, name)
26
+ lookup = context
27
+ name.split(".").each do |value|
28
+ lookup = lookup[value]
29
+ end
30
+ lookup
28
31
  end
29
- lookup
30
- end
31
-
32
- def set_template( template )
33
- supported_templates = WebmentionIO.types + ['count', 'webmentions']
34
32
 
35
- WebmentionIO.log 'error', "#{template} is not supported" if ! supported_templates.include? template
33
+ def set_template( template )
34
+ supported_templates = Jekyll::WebmentionIO::types + ['count', 'webmentions']
35
+
36
+ Jekyll::WebmentionIO::log 'error', "#{template} is not supported" if ! supported_templates.include? template
36
37
 
37
- if WebmentionIO.config.has_key? 'templates' and WebmentionIO.config['templates'].has_key? template
38
- # WebmentionIO.log 'info', "Using custom #{template} template"
39
- template_file = WebmentionIO.config['templates'][template]
40
- else
41
- # WebmentionIO.log 'info', "Using default #{template} template"
42
- template_file = File.join(File.dirname(File.expand_path(__FILE__)), "../../../templates/#{template}.html")
43
- end
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
44
45
 
45
- # WebmentionIO.log 'info', "Template file: #{template_file}"
46
- handler = File.open(template_file, 'rb')
47
- @template = handler.read
48
- # WebmentionIO.log 'info', "template: #{@template}"
49
- end
46
+ # Jekyll::WebmentionIO::log 'info', "Template file: #{template_file}"
47
+ handler = File.open(template_file, 'rb')
48
+ @template = handler.read
49
+ # Jekyll::WebmentionIO::log 'info', "template: #{@template}"
50
+ end
50
51
 
51
- def set_data(data)
52
- @data = { 'webmentions' => data }
53
- end
52
+ def set_data(data)
53
+ @data = { 'webmentions' => data }
54
+ end
54
55
 
55
- def extract_type( type, webmentions )
56
- # WebmentionIO.log 'info', "Looking for #{type}"
57
- keep = {}
58
- if ! WebmentionIO.types.include? type
59
- WebmentionIO.log 'warn', "#{type} are not extractable"
60
- else
61
- type = type.to_singular
62
- # WebmentionIO.log 'info', "Searching #{webmentions.length} webmentions for type==#{type}"
63
- if webmentions.is_a? Hash
64
- webmentions = webmentions.values
65
- end
66
- webmentions.each do |webmention|
67
- keep[webmention['id']] = webmention if webmention['type'] == type
56
+ def extract_type( type, webmentions )
57
+ # Jekyll::WebmentionIO::log 'info', "Looking for #{type}"
58
+ keep = {}
59
+ if ! Jekyll::WebmentionIO::types.include? type
60
+ Jekyll::WebmentionIO::log 'warn', "#{type} are not extractable"
61
+ else
62
+ type = type.to_singular
63
+ # Jekyll::WebmentionIO::log 'info', "Searching #{webmentions.length} webmentions for type==#{type}"
64
+ if webmentions.is_a? Hash
65
+ webmentions = webmentions.values
66
+ end
67
+ webmentions.each do |webmention|
68
+ keep[webmention['id']] = webmention if webmention['type'] == type
69
+ end
68
70
  end
71
+ keep
69
72
  end
70
- keep
71
- end
72
73
 
73
- def sort_webmentions( webmentions )
74
- return webmentions.sort_by { |webmention| webmention['pubdate'].to_i }
75
- end
74
+ def sort_webmentions( webmentions )
75
+ return webmentions.sort_by { |webmention| webmention['pubdate'].to_i }
76
+ end
76
77
 
77
- def render(context)
78
- output = super
79
-
80
- # Get the URI
81
- args = @text.split(/\s+/).map(&:strip)
82
- uri = args.shift
83
- uri = lookup(context, uri)
78
+ def render(context)
79
+ output = super
80
+
81
+ # Get the URI
82
+ args = @text.split(/\s+/).map(&:strip)
83
+ uri = args.shift
84
+ uri = lookup(context, uri)
84
85
 
85
- if @cached_webmentions.has_key? uri
86
- all_webmentions = @cached_webmentions[uri].clone
87
- # WebmentionIO.log 'info', "#{all_webmentions.length} total webmentions for #{uri}"
88
- if args.length > 0
89
- # WebmentionIO.log 'info', "Requesting only #{args.inspect}"
90
- webmentions = {}
91
- args.each do |type|
92
- extracted = extract_type( type, all_webmentions )
93
- # WebmentionIO.log 'info', "Merging in #{extracted.length} #{type}"
94
- webmentions = webmentions.merge( extracted )
86
+ if @cached_webmentions.has_key? uri
87
+ all_webmentions = @cached_webmentions[uri].clone
88
+ # Jekyll::WebmentionIO::log 'info', "#{all_webmentions.length} total webmentions for #{uri}"
89
+ if args.length > 0
90
+ # Jekyll::WebmentionIO::log 'info', "Requesting only #{args.inspect}"
91
+ webmentions = {}
92
+ args.each do |type|
93
+ extracted = extract_type( type, all_webmentions )
94
+ # Jekyll::WebmentionIO::log 'info', "Merging in #{extracted.length} #{type}"
95
+ webmentions = webmentions.merge( extracted )
96
+ end
97
+ else
98
+ # Jekyll::WebmentionIO::log 'info', 'Grabbing all webmentions'
99
+ webmentions = all_webmentions
95
100
  end
96
- else
97
- # WebmentionIO.log 'info', 'Grabbing all webmentions'
98
- webmentions = all_webmentions
99
- end
100
101
 
101
- if webmentions.is_a? Hash
102
- webmentions = webmentions.values
103
- end
102
+ if webmentions.is_a? Hash
103
+ webmentions = webmentions.values
104
+ end
104
105
 
105
- webmentions = sort_webmentions( webmentions )
106
+ webmentions = sort_webmentions( webmentions )
107
+
108
+ set_data( webmentions )
109
+ end
106
110
 
107
- set_data( webmentions )
108
- end
109
-
110
- args = nil
111
+ args = nil
111
112
 
112
- if @template and @data
113
- # WebmentionIO.log 'info', "Preparing to render\n\n#{@data.inspect}\n\ninto\n\n#{@template}"
114
- template = Liquid::Template.parse(@template, :error_mode => :strict)
115
- html = template.render(@data, { strict_variables: true, strict_filters: true })
116
- template.errors.each do |error|
117
- WebmentionIO.log 'error', error
118
- end
119
- # Clean up the output
120
- HtmlBeautifier.beautify html.each_line.reject{|x| x.strip == ""}.join
121
- else
122
- if ! @template
123
- WebmentionIO.log 'warn', "#{self.class} No template provided"
124
- end
125
- if ! @data
126
- WebmentionIO.log 'warn', "#{self.class} No data provided"
113
+ if @template and @data
114
+ # Jekyll::WebmentionIO::log 'info', "Preparing to render\n\n#{@data.inspect}\n\ninto\n\n#{@template}"
115
+ template = Liquid::Template.parse(@template, :error_mode => :strict)
116
+ html = template.render(@data, { strict_variables: true, strict_filters: true })
117
+ template.errors.each do |error|
118
+ Jekyll::WebmentionIO::log 'error', error
119
+ end
120
+ # Clean up the output
121
+ HtmlBeautifier.beautify html.each_line.reject{|x| x.strip == ""}.join
122
+ else
123
+ if ! @template
124
+ Jekyll::WebmentionIO::log 'warn', "#{self.class} No template provided"
125
+ end
126
+ if ! @data
127
+ Jekyll::WebmentionIO::log 'warn', "#{self.class} No data provided"
128
+ end
129
+ ""
127
130
  end
128
- ""
129
131
  end
130
132
  end
131
133
  end
@@ -8,19 +8,21 @@
8
8
  # {% webmention_count post.url [ likes | links | posts | replies | reposts ]* %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionCountTag < WebmentionTag
11
+ module WebmentionIO
12
+ class WebmentionCountTag < Jekyll::WebmentionIO::WebmentionTag
12
13
 
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'count'
17
- end
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'count'
18
+ end
18
19
 
19
- def set_data(data)
20
- @data = { 'count' => data.length }
21
- end
20
+ def set_data(data)
21
+ @data = { 'count' => data.length }
22
+ end
22
23
 
24
+ end
23
25
  end
24
26
  end
25
27
 
26
- Liquid::Template.register_tag('webmention_count', Jekyll::WebmentionCountTag)
28
+ Liquid::Template.register_tag('webmention_count', Jekyll::WebmentionIO::WebmentionCountTag)
@@ -8,20 +8,22 @@
8
8
  # {% webmention_likes post.url %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionLikesTag < WebmentionTag
11
+ module WebmentionIO
12
+ class WebmentionLikesTag < Jekyll::WebmentionIO::WebmentionTag
12
13
 
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'likes'
17
- end
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'likes'
18
+ end
18
19
 
19
- def set_data(data)
20
- webmentions = extract_type 'likes', data
21
- @data = { 'webmentions' => webmentions.values }
22
- end
20
+ def set_data(data)
21
+ webmentions = extract_type 'likes', data
22
+ @data = { 'webmentions' => webmentions.values }
23
+ end
23
24
 
25
+ end
24
26
  end
25
27
  end
26
28
 
27
- Liquid::Template.register_tag('webmention_likes', Jekyll::WebmentionLikesTag)
29
+ Liquid::Template.register_tag('webmention_likes', Jekyll::WebmentionIO::WebmentionLikesTag)
@@ -8,20 +8,22 @@
8
8
  # {% webmention_links post.url %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionLinksTag < WebmentionTag
11
+ module WebmentionIO
12
+ class WebmentionLinksTag < Jekyll::WebmentionIO::WebmentionTag
12
13
 
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'links'
17
- end
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'links'
18
+ end
18
19
 
19
- def set_data(data)
20
- webmentions = extract_type 'links', data
21
- @data = { 'webmentions' => webmentions.values }
22
- end
20
+ def set_data(data)
21
+ webmentions = extract_type 'links', data
22
+ @data = { 'webmentions' => webmentions.values }
23
+ end
23
24
 
25
+ end
24
26
  end
25
27
  end
26
28
 
27
- Liquid::Template.register_tag('webmention_links', Jekyll::WebmentionLinksTag)
29
+ Liquid::Template.register_tag('webmention_links', Jekyll::WebmentionIO::WebmentionLinksTag)
@@ -8,20 +8,22 @@
8
8
  # {% webmention_posts post.url %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionRepostsTag < WebmentionTag
11
+ module WebmentionIO
12
+ class WebmentionRepostsTag < Jekyll::WebmentionIO::WebmentionTag
12
13
 
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'posts'
17
- end
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'posts'
18
+ end
18
19
 
19
- def set_data(data)
20
- webmentions = extract_type 'posts', data
21
- @data = { 'webmentions' => webmentions.values }
22
- end
20
+ def set_data(data)
21
+ webmentions = extract_type 'posts', data
22
+ @data = { 'webmentions' => webmentions.values }
23
+ end
23
24
 
25
+ end
24
26
  end
25
27
  end
26
28
 
27
- Liquid::Template.register_tag('webmention_posts', Jekyll::WebmentionRepostsTag)
29
+ Liquid::Template.register_tag('webmention_posts', Jekyll::WebmentionIO::WebmentionRepostsTag)
@@ -8,20 +8,22 @@
8
8
  # {% webmention_replies post.url %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionRepliesTag < WebmentionTag
11
+ module WebmentionIO
12
+ class WebmentionRepliesTag < Jekyll::WebmentionIO::WebmentionTag
12
13
 
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'replies'
17
- end
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'replies'
18
+ end
18
19
 
19
- def set_data(data)
20
- webmentions = extract_type 'replies', data
21
- @data = { 'webmentions' => webmentions.values }
22
- end
20
+ def set_data(data)
21
+ webmentions = extract_type 'replies', data
22
+ @data = { 'webmentions' => webmentions.values }
23
+ end
23
24
 
25
+ end
24
26
  end
25
27
  end
26
28
 
27
- Liquid::Template.register_tag('webmention_replies', Jekyll::WebmentionRepliesTag)
29
+ Liquid::Template.register_tag('webmention_replies', Jekyll::WebmentionIO::WebmentionRepliesTag)
@@ -8,20 +8,22 @@
8
8
  # {% webmention_reposts post.url %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionRepostsTag < WebmentionTag
11
+ module WebmentionIO
12
+ class WebmentionRepostsTag < Jekyll::WebmentionIO::WebmentionTag
12
13
 
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'reposts'
17
- end
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'reposts'
18
+ end
18
19
 
19
- def set_data(data)
20
- webmentions = extract_type 'reposts', data
21
- @data = { 'webmentions' => webmentions.values }
22
- end
20
+ def set_data(data)
21
+ webmentions = extract_type 'reposts', data
22
+ @data = { 'webmentions' => webmentions.values }
23
+ end
23
24
 
25
+ end
24
26
  end
25
27
  end
26
28
 
27
- Liquid::Template.register_tag('webmention_reposts', Jekyll::WebmentionRepostsTag)
29
+ Liquid::Template.register_tag('webmention_reposts', Jekyll::WebmentionIO::WebmentionRepostsTag)
@@ -8,16 +8,17 @@
8
8
  # {% webmentions post.url [ likes | links | posts | replies | reposts ]* %}
9
9
  #
10
10
  module Jekyll
11
- class WebmentionsTag < WebmentionTag
12
-
13
- def initialize(tagName, text, tokens)
14
- super
15
- @text = text
16
- set_template 'webmentions'
17
- end
11
+ module WebmentionIO
12
+ class WebmentionsTag < Jekyll::WebmentionIO::WebmentionTag
13
+
14
+ def initialize(tagName, text, tokens)
15
+ super
16
+ @text = text
17
+ set_template 'webmentions'
18
+ end
18
19
 
20
+ end
19
21
  end
20
-
21
22
  end
22
23
 
23
- Liquid::Template.register_tag('webmentions', Jekyll::WebmentionsTag)
24
+ Liquid::Template.register_tag('webmentions', Jekyll::WebmentionIO::WebmentionsTag)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,5 @@
1
- module WebmentionIO
2
- VERSION = "2.0.8"
1
+ module Jekyll
2
+ module WebmentionIO
3
+ VERSION = "2.0.9"
4
+ end
3
5
  end
@@ -5,7 +5,7 @@
5
5
  # this liquid plugin insert a webmentions into your Octopress or Jekill blog
6
6
  # using http://webmention.io/ and the following syntax:
7
7
  #
8
- require 'jekyll/webmention_io/version'
8
+ require_relative 'webmention_io/version'
9
9
 
10
10
  require 'json'
11
11
  require 'net/http'
@@ -14,38 +14,40 @@ require 'openssl'
14
14
  require 'string_inflection'
15
15
 
16
16
  module Jekyll
17
- class WebmentionIO
17
+ module WebmentionIO
18
18
 
19
19
  @logger_prefix = '[jekyll-webmention_io]'
20
20
 
21
- # @jekyll_config = Jekyll.configuration({ 'quiet' => true })
22
- @jekyll_config = Jekyll.configuration({})
23
- @config = @jekyll_config['webmentions']
24
-
25
21
  @api_url = 'https://webmention.io/api'
26
22
  @api_endpoint = @api_url
27
23
  @api_suffix = ''
28
24
 
29
- # Set up the cache folder & files
30
- cache_folder = @config['cache_folder'] || '.cache'
31
- Dir.mkdir(cache_folder) unless File.exists?(cache_folder)
32
- file_prefix = ''
33
- if ! cache_folder.include? 'webmention'
34
- file_prefix = 'webmention_io_'
35
- end
36
- @cache_files = {
37
- 'incoming' => "#{cache_folder}/#{file_prefix}received.yml",
38
- 'outgoing' => "#{cache_folder}/#{file_prefix}queued.yml",
39
- 'sent' => "#{cache_folder}/#{file_prefix}sent.yml",
40
- 'bad_uris' => "#{cache_folder}/#{file_prefix}bad_uris.yml"
41
- }
42
- @cache_files.each do |key, file|
43
- if ! File.exists?(file)
44
- File.open(file, 'w') { |f| YAML.dump({}, f) }
25
+ @types = ['likes','links','posts','replies','reposts']
26
+
27
+ def self.bootstrap()
28
+ # @jekyll_config = Jekyll.configuration({ 'quiet' => true })
29
+ @jekyll_config = Jekyll::configuration({})
30
+ @config = @jekyll_config['webmentions'] || {}
31
+
32
+ # Set up the cache folder & files
33
+ cache_folder = @config['cache_folder'] || '.cache'
34
+ Dir.mkdir(cache_folder) unless File.exists?(cache_folder)
35
+ file_prefix = ''
36
+ if ! cache_folder.include? 'webmention'
37
+ file_prefix = 'webmention_io_'
38
+ end
39
+ @cache_files = {
40
+ 'incoming' => "#{cache_folder}/#{file_prefix}received.yml",
41
+ 'outgoing' => "#{cache_folder}/#{file_prefix}queued.yml",
42
+ 'sent' => "#{cache_folder}/#{file_prefix}sent.yml",
43
+ 'bad_uris' => "#{cache_folder}/#{file_prefix}bad_uris.yml"
44
+ }
45
+ @cache_files.each do |key, file|
46
+ if ! File.exists?(file)
47
+ File.open(file, 'w') { |f| YAML.dump({}, f) }
48
+ end
45
49
  end
46
50
  end
47
-
48
- @types = ['likes','links','posts','replies','reposts']
49
51
 
50
52
  # Attributes
51
53
  def self.config
@@ -1 +1,4 @@
1
- require 'jekyll/webmention_io'
1
+ require 'jekyll'
2
+ require 'jekyll/webmention_io'
3
+
4
+ Jekyll::WebmentionIO::bootstrap();
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.0.8
4
+ version: 2.0.9
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-06-22 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -44,6 +44,34 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: http
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: openssl
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.0'
47
75
  - !ruby/object:Gem::Dependency
48
76
  name: string_inflection
49
77
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +100,20 @@ dependencies:
72
100
  - - "~>"
73
101
  - !ruby/object:Gem::Version
74
102
  version: '1.1'
103
+ - !ruby/object:Gem::Dependency
104
+ name: bundler
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.14'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.14'
75
117
  - !ruby/object:Gem::Dependency
76
118
  name: rake
77
119
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +128,34 @@ dependencies:
86
128
  - - "~>"
87
129
  - !ruby/object:Gem::Version
88
130
  version: '12.0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rspec
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '3.5'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '3.5'
145
+ - !ruby/object:Gem::Dependency
146
+ name: html-proofer
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '3.6'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '3.6'
89
159
  - !ruby/object:Gem::Dependency
90
160
  name: rubocop
91
161
  requirement: !ruby/object:Gem::Requirement
@@ -117,11 +187,8 @@ executables: []
117
187
  extensions: []
118
188
  extra_rdoc_files: []
119
189
  files:
120
- - CODE_OF_CONDUCT.md
121
- - LICENSE
122
- - README.md
123
- - assets/webmention_io.js
124
190
  - lib/jekyll-webmention_io.rb
191
+ - lib/jekyll/assets/webmention_io.js
125
192
  - lib/jekyll/commands/webmention.rb
126
193
  - lib/jekyll/generators/gather_webmentions.rb
127
194
  - lib/jekyll/generators/queue_webmentions.rb
@@ -133,15 +200,15 @@ files:
133
200
  - lib/jekyll/tags/replies.rb
134
201
  - lib/jekyll/tags/reposts.rb
135
202
  - lib/jekyll/tags/webmentions.rb
203
+ - lib/jekyll/templates/count.html
204
+ - lib/jekyll/templates/likes.html
205
+ - lib/jekyll/templates/links.html
206
+ - lib/jekyll/templates/posts.html
207
+ - lib/jekyll/templates/replies.html
208
+ - lib/jekyll/templates/reposts.html
209
+ - lib/jekyll/templates/webmentions.html
136
210
  - lib/jekyll/webmention_io.rb
137
211
  - lib/jekyll/webmention_io/version.rb
138
- - templates/count.html
139
- - templates/likes.html
140
- - templates/links.html
141
- - templates/posts.html
142
- - templates/replies.html
143
- - templates/reposts.html
144
- - templates/webmentions.html
145
212
  homepage: https://github.com/aarongustafson/jekyll-webmention_io
146
213
  licenses:
147
214
  - MIT
@@ -149,7 +216,7 @@ metadata: {}
149
216
  post_install_message:
150
217
  rdoc_options: []
151
218
  require_paths:
152
- - "."
219
+ - lib
153
220
  required_ruby_version: !ruby/object:Gem::Requirement
154
221
  requirements:
155
222
  - - ">="
data/CODE_OF_CONDUCT.md DELETED
@@ -1,46 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- ## Our Standards
8
-
9
- Examples of behavior that contributes to creating a positive environment include:
10
-
11
- * Using welcoming and inclusive language
12
- * Being respectful of differing viewpoints and experiences
13
- * Gracefully accepting constructive criticism
14
- * Focusing on what is best for the community
15
- * Showing empathy towards other community members
16
-
17
- Examples of unacceptable behavior by participants include:
18
-
19
- * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
- * Trolling, insulting/derogatory comments, and personal or political attacks
21
- * Public or private harassment
22
- * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
- * Other conduct which could reasonably be considered inappropriate in a professional setting
24
-
25
- ## Our Responsibilities
26
-
27
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
-
29
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
-
31
- ## Scope
32
-
33
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
-
35
- ## Enforcement
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@easy-designs.net. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
-
39
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
-
41
- ## Attribution
42
-
43
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
-
45
- [homepage]: http://contributor-covenant.org
46
- [version]: http://contributor-covenant.org/version/1/4/
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Aaron Gustafson
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
data/README.md DELETED
@@ -1,109 +0,0 @@
1
- # Liquid Webmention Tag for Jekyll and Octopress
2
-
3
- This plugin makes it possible to load [webmentions](http://indiewebcamp.com/webmention) from [Webmention.io](http://webmention.io) into your Jekyll and Octopress projects. It currently supports the following:
4
-
5
- ## Webmention Count
6
-
7
- Get a count of webmentions for a page or post using the following liquid tag:
8
-
9
- {% webmention_count YOUR_URL %}
10
-
11
- The output will simply be a number.
12
-
13
- ## Webmention List
14
-
15
- You can get a complete list of webmentions for a page or post using the following liquid tag:
16
-
17
- {% webmentions YOUR_URL %}
18
-
19
- If webmentions are found, this is the format they will come out in:
20
-
21
- <div class="webmentions">
22
- <ol class="webmentions__list">
23
- <!-- if it has a Name/Title, this is the generated code -->
24
- <li class="webmentions__item">
25
- <article class="webmention webmention--title-only">
26
- <!-- if Author this block appears -->
27
- <div class="webmention__author vcard">
28
- <!-- if Author Link the name is wrapped in a link -->
29
- <a class="fn url" href="https://kylewm.com">
30
- <!-- if Author Photo -->
31
- <img class="webmention__author__photo photo" src="/static/img/users/kyle.jpg" alt="">
32
- Kyle Mahan
33
- </a>
34
- </div>
35
- <div class="webmention__title">
36
- <a href="https://kylewm.com/2014/03/renaming-my-blog-engine-groomsman-to-red-wind">renaming my blog engine Groomsman to Red Wind</a>
37
- </div>
38
- <div class="webmention__meta">
39
- <time class="webmention__pubdate" datetime="2014-03-13T20:33:42+00:00">13 March 2014</time>
40
- </div>
41
- </article>
42
- </li>
43
- <!-- if it has Content, but no Name, this is the generated code -->
44
- <li class="webmentions__item">
45
- <article class="webmention webmention--content-only">
46
- <div class="webmention__meta">
47
- <time class="webmention__pubdate" datetime="2014-11-11T15:30:18+00:00">11 November 2014</time>
48
- |
49
- <a class="webmention__source" href="http://aaronparecki.com/replies/2014/11/11/4/drupal">Permalink</a>
50
- </div>
51
- <div class="webmention__content">
52
- <!-- This is run through Markdown -->
53
- <p>@noneck @indiewebcamp Well the good news is there&rsquo;s lots of PHP libraries which should be easy to use in #drupal! <a href="http://indiewebcamp.com/PHP#Libraries">http://indiewebcamp.com/PHP#Libraries</a></p>
54
- </div>
55
- </article>
56
- </li>
57
- </ol>
58
- </div>
59
-
60
- If no webmentions are found, the plugin spits out this:
61
-
62
- <div class="webmentions">
63
- <p class="webmentions__not-found">No webmentions were found</p>
64
- </div>
65
-
66
- To summarize the classes, here’s what you have to work with:
67
-
68
- * `webmentions` - overall container (`div`)
69
- * `webmentions__list` - the list of webmentions (`ol`)
70
- * `webmentions__item` - the webmention container (`li`)
71
- * `webmention` - the webmention itself (`article`)
72
- * `webmention--title-only` - title-only variant
73
- * `webmention--content-only` - content-only variant
74
- * `webmention--author-starts` - variant for when the author’s name starts the title or content
75
- * `webmention__author` - Author of the webmention (`div`)
76
- * `webmention__author__photo` - Author’s photo (`img`)
77
- * `webmention__title` - The webmention’s title (`div`)
78
- * `webmention__content` - The webmention’s content (`div`)
79
- * `webmention__meta` - The webmention’s meta information container (`div`)
80
- * `webmention__pubdate` - The publication date (`time`)
81
- * `webmention__source` - The webmention permalink (`a`)
82
- * `webmentions__not-found` - The "no results" message (`p`)
83
-
84
- Note: Webmentions are cached to the `.cache` directory in a file named `webmentions_received.yml`. If you are unhappy with how a webmention is displayed, you can alter the HTML in this file, but be careful, the file must remain valid YAML. But if you botch things, you can always delete the file and the webmentions will be re-cached.
85
-
86
- ## JavaScript (optional)
87
-
88
- I have also included a JavaScript file that will keep your webmentions up to date even when you don’t publish frequently. It will also update your page’s webmentions in realtime.
89
-
90
- To inform the JavaScript of additional URLs to check (e.g. when the current page receives redirects from old URLs), use the following `meta` element:
91
-
92
- <meta property="webmention:redirected_from" content="URL_1,URL_2">
93
-
94
- The `content` attribute should contain a single URL or multiple URLs separated by commas.
95
-
96
- ## Publishing Webmentions
97
-
98
- Included in this repo is a [Rake](https://github.com/ruby/rake) task for publishing webmentions (webmention.Rakefile). You can add this task to your global Rakefile or reference it. Just be sure to update the path for your `.cache` folder
99
-
100
- The workflow is as follows:
101
-
102
- 1. `rake generate` to generate your site and collect a list of mentioned URLs in your posts
103
- 2. `rake webmention` to cycle through those URLs and post to any that offer webmention endpoints.
104
-
105
- Notes:
106
-
107
- * If an endpoint is not offered, the URL will be skipped and can be processed later.
108
- * In order to streamline the process, a webmention connection will only be processed once (and cached so it can be skipped).
109
- * You may want to add `.cache` to your `.gitignore` file.