jekyll-crosspost-to-medium 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-crosspost-to-medium.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f308fe874b90ec7976cbbd5b24cac0d03b803cc
|
4
|
+
data.tar.gz: a45e4680b839edd59bec532cac226332e695a500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ed3595c1654707ff950c3fd263b8ea7c1e7b92a9273f69dda5e99ff45c048fcee002cabcbeb0354d3fdc84b8873e97be2dc3fd7e8f46d3740e721e4fe70e674
|
7
|
+
data.tar.gz: 466c411f83a39dfdf94043578baffa730d8c0895f10c185d69db3e867ffbd73f1f04826b3d7cf72dd883e19271e371eedc29c6e05cd735591e6879e997ab1adb
|
@@ -20,6 +20,7 @@ require 'net/http'
|
|
20
20
|
require 'net/https'
|
21
21
|
require 'kramdown'
|
22
22
|
require 'uri'
|
23
|
+
require 'date'
|
23
24
|
|
24
25
|
module Jekyll
|
25
26
|
class MediumCrossPostGenerator < Generator
|
@@ -32,6 +33,7 @@ module Jekyll
|
|
32
33
|
@settings = @site.config['jekyll-crosspost_to_medium'] || {}
|
33
34
|
globally_enabled = if @settings.has_key? 'enabled' then @settings['enabled'] else true end
|
34
35
|
cache_dir = @settings['cache'] || @site.config['source'] + '/.jekyll-crosspost_to_medium'
|
36
|
+
backdate = if @settings.has_key? 'backdate' then @settings['backdate'] else true end
|
35
37
|
@crossposted_file = File.join(cache_dir, "medium_crossposted.yml")
|
36
38
|
|
37
39
|
if globally_enabled
|
@@ -77,8 +79,10 @@ module Jekyll
|
|
77
79
|
content = post.content
|
78
80
|
url = "#{@site.config['url']}#{post.url}"
|
79
81
|
title = post.data['title']
|
82
|
+
|
83
|
+
published_at = backdate ? post.date : DateTime.now
|
80
84
|
|
81
|
-
crosspost_payload(crossposted, post, content, title, url)
|
85
|
+
crosspost_payload(crossposted, post, content, title, url, published_at)
|
82
86
|
end
|
83
87
|
else
|
84
88
|
|
@@ -109,8 +113,10 @@ module Jekyll
|
|
109
113
|
|
110
114
|
url = "#{@site.config['url']}#{post.url}"
|
111
115
|
title = post.title
|
116
|
+
|
117
|
+
published_at = backdate ? post.date : DateTime.now
|
112
118
|
|
113
|
-
crosspost_payload(crossposted, post, content, title, url)
|
119
|
+
crosspost_payload(crossposted, post, content, title, url, published_at)
|
114
120
|
|
115
121
|
end
|
116
122
|
end
|
@@ -119,7 +125,7 @@ module Jekyll
|
|
119
125
|
end
|
120
126
|
|
121
127
|
|
122
|
-
def crosspost_payload(crossposted, post, content, title, url)
|
128
|
+
def crosspost_payload(crossposted, post, content, title, url, published_at)
|
123
129
|
# Update any absolute URLs
|
124
130
|
# But don’t clobber protocol-less (i.e. "//") URLs
|
125
131
|
content = content.gsub /href=(["'])\/(?!\/)/, "href=\\1#{@site.config['url']}/"
|
@@ -161,6 +167,7 @@ module Jekyll
|
|
161
167
|
'content' => content,
|
162
168
|
'tags' => tags,
|
163
169
|
'publishStatus' => @settings['status'] || "public",
|
170
|
+
'publishedAt' => published_at.iso8601,
|
164
171
|
'license' => @settings['license'] || "all-rights-reserved",
|
165
172
|
'canonicalUrl' => canonical_url
|
166
173
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-crosspost-to-medium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Gustafson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: " This generator cross-posts entries to Medium. To work, this script
|
14
14
|
requires\n a MEDIUM_USER_ID environment variable and a MEDIUM_INTEGRATION_TOKEN.\n\n
|