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 +4 -4
- data/{assets → lib/jekyll/assets}/webmention_io.js +0 -0
- data/lib/jekyll/commands/webmention.rb +4 -4
- data/lib/jekyll/generators/gather_webmentions.rb +11 -11
- data/lib/jekyll/generators/queue_webmentions.rb +3 -3
- data/lib/jekyll/tags/_.rb +101 -99
- data/lib/jekyll/tags/count.rb +12 -10
- data/lib/jekyll/tags/likes.rb +13 -11
- data/lib/jekyll/tags/links.rb +13 -11
- data/lib/jekyll/tags/posts.rb +13 -11
- data/lib/jekyll/tags/replies.rb +13 -11
- data/lib/jekyll/tags/reposts.rb +13 -11
- data/lib/jekyll/tags/webmentions.rb +10 -9
- data/{templates → lib/jekyll/templates}/count.html +0 -0
- data/{templates → lib/jekyll/templates}/likes.html +0 -0
- data/{templates → lib/jekyll/templates}/links.html +0 -0
- data/{templates → lib/jekyll/templates}/posts.html +0 -0
- data/{templates → lib/jekyll/templates}/replies.html +0 -0
- data/{templates → lib/jekyll/templates}/reposts.html +0 -0
- data/{templates → lib/jekyll/templates}/webmentions.html +0 -0
- data/lib/jekyll/webmention_io/version.rb +4 -2
- data/lib/jekyll/webmention_io.rb +26 -24
- data/lib/jekyll-webmention_io.rb +4 -1
- metadata +81 -14
- data/CODE_OF_CONDUCT.md +0 -46
- data/LICENSE +0 -22
- data/README.md +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c4de12f753eb0089ea97d4f6f4d6eb31331b54
|
4
|
+
data.tar.gz: 543d88d8d727574fb0e237586279b46d219d5468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
15
|
-
cached_sent = WebmentionIO
|
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
|
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
|
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
|
15
|
+
Jekyll::WebmentionIO::log 'info', 'Beginning to gather webmentions of your posts. This may take a while.'
|
16
16
|
|
17
|
-
WebmentionIO
|
17
|
+
Jekyll::WebmentionIO::set_api_endpoint('mentions')
|
18
18
|
# add an arbitrarily high perPage to trump pagination
|
19
|
-
WebmentionIO
|
19
|
+
Jekyll::WebmentionIO::set_api_suffix('&perPage=9999')
|
20
20
|
|
21
|
-
cache_file = WebmentionIO
|
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
|
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
|
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
|
74
|
-
# WebmentionIO
|
75
|
-
WebmentionIO
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
52
|
+
def set_data(data)
|
53
|
+
@data = { 'webmentions' => data }
|
54
|
+
end
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
74
|
+
def sort_webmentions( webmentions )
|
75
|
+
return webmentions.sort_by { |webmention| webmention['pubdate'].to_i }
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
102
|
-
|
103
|
-
|
102
|
+
if webmentions.is_a? Hash
|
103
|
+
webmentions = webmentions.values
|
104
|
+
end
|
104
105
|
|
105
|
-
|
106
|
+
webmentions = sort_webmentions( webmentions )
|
107
|
+
|
108
|
+
set_data( webmentions )
|
109
|
+
end
|
106
110
|
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
args = nil
|
111
|
+
args = nil
|
111
112
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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
|
data/lib/jekyll/tags/count.rb
CHANGED
@@ -8,19 +8,21 @@
|
|
8
8
|
# {% webmention_count post.url [ likes | links | posts | replies | reposts ]* %}
|
9
9
|
#
|
10
10
|
module Jekyll
|
11
|
-
|
11
|
+
module WebmentionIO
|
12
|
+
class WebmentionCountTag < Jekyll::WebmentionIO::WebmentionTag
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize(tagName, text, tokens)
|
15
|
+
super
|
16
|
+
@text = text
|
17
|
+
set_template 'count'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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)
|
data/lib/jekyll/tags/likes.rb
CHANGED
@@ -8,20 +8,22 @@
|
|
8
8
|
# {% webmention_likes post.url %}
|
9
9
|
#
|
10
10
|
module Jekyll
|
11
|
-
|
11
|
+
module WebmentionIO
|
12
|
+
class WebmentionLikesTag < Jekyll::WebmentionIO::WebmentionTag
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize(tagName, text, tokens)
|
15
|
+
super
|
16
|
+
@text = text
|
17
|
+
set_template 'likes'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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)
|
data/lib/jekyll/tags/links.rb
CHANGED
@@ -8,20 +8,22 @@
|
|
8
8
|
# {% webmention_links post.url %}
|
9
9
|
#
|
10
10
|
module Jekyll
|
11
|
-
|
11
|
+
module WebmentionIO
|
12
|
+
class WebmentionLinksTag < Jekyll::WebmentionIO::WebmentionTag
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize(tagName, text, tokens)
|
15
|
+
super
|
16
|
+
@text = text
|
17
|
+
set_template 'links'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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)
|
data/lib/jekyll/tags/posts.rb
CHANGED
@@ -8,20 +8,22 @@
|
|
8
8
|
# {% webmention_posts post.url %}
|
9
9
|
#
|
10
10
|
module Jekyll
|
11
|
-
|
11
|
+
module WebmentionIO
|
12
|
+
class WebmentionRepostsTag < Jekyll::WebmentionIO::WebmentionTag
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize(tagName, text, tokens)
|
15
|
+
super
|
16
|
+
@text = text
|
17
|
+
set_template 'posts'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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)
|
data/lib/jekyll/tags/replies.rb
CHANGED
@@ -8,20 +8,22 @@
|
|
8
8
|
# {% webmention_replies post.url %}
|
9
9
|
#
|
10
10
|
module Jekyll
|
11
|
-
|
11
|
+
module WebmentionIO
|
12
|
+
class WebmentionRepliesTag < Jekyll::WebmentionIO::WebmentionTag
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize(tagName, text, tokens)
|
15
|
+
super
|
16
|
+
@text = text
|
17
|
+
set_template 'replies'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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)
|
data/lib/jekyll/tags/reposts.rb
CHANGED
@@ -8,20 +8,22 @@
|
|
8
8
|
# {% webmention_reposts post.url %}
|
9
9
|
#
|
10
10
|
module Jekyll
|
11
|
-
|
11
|
+
module WebmentionIO
|
12
|
+
class WebmentionRepostsTag < Jekyll::WebmentionIO::WebmentionTag
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize(tagName, text, tokens)
|
15
|
+
super
|
16
|
+
@text = text
|
17
|
+
set_template 'reposts'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
File without changes
|
data/lib/jekyll/webmention_io.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
'
|
38
|
-
|
39
|
-
'
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
data/lib/jekyll-webmention_io.rb
CHANGED
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.
|
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-
|
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’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.
|