jekyll-notion-import 0.0.1 → 0.0.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a075edd60ef1c28539f39aaab9029b48b9339616ce69a493fdd89d107114c558
|
4
|
+
data.tar.gz: 71fd6c80c746e5c4b8c6edf63807e2a5109e41aa33df633638852060058e374c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ff3fa21f975a726ed8d0b2d37311b468dca9133c434b045d96cc0087ddd6dca89df19ba1ffb108986754a6d62ed82c0f8b67b3b5388bb04b6d3b76c1a8aa3f
|
7
|
+
data.tar.gz: 5a4f2f0f38a4f95ca155f1aec241a42d66d87d8f4480bd067474faa68397ff197e8b439567216c17629e835413ab0adf3f37827d480b2a81e4c70d12f7e1d133
|
@@ -20,7 +20,8 @@ module Jekyll
|
|
20
20
|
database.fetch.each do |page|
|
21
21
|
Post.new(
|
22
22
|
collection_name: database.collection_name,
|
23
|
-
page
|
23
|
+
page:,
|
24
|
+
default_front_matter: Hash(database_config["default_front_matter"])
|
24
25
|
).import
|
25
26
|
end
|
26
27
|
end
|
@@ -29,21 +30,21 @@ module Jekyll
|
|
29
30
|
private
|
30
31
|
|
31
32
|
attr_reader :config
|
32
|
-
|
33
|
+
|
33
34
|
def notion_token?
|
34
35
|
return true unless ENV["NOTION_TOKEN"].blank?
|
35
|
-
|
36
|
+
|
36
37
|
Jekyll.logger.warn("Jekyll Notion Import:",
|
37
38
|
"NOTION_TOKEN not provided. Cannot read from Notion.")
|
38
39
|
false
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
def config?
|
42
43
|
return true unless config.empty?
|
43
|
-
|
44
|
+
|
44
45
|
Jekyll.logger.warn("Jekyll Notion:", "No config provided.")
|
45
46
|
false
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
49
|
-
end
|
50
|
+
end
|
@@ -3,9 +3,10 @@
|
|
3
3
|
module Jekyll
|
4
4
|
module NotionImport
|
5
5
|
class Post
|
6
|
-
def initialize(collection_name:, page:)
|
6
|
+
def initialize(collection_name:, page:, default_front_matter:)
|
7
7
|
@page = page
|
8
8
|
@collection_name = collection_name
|
9
|
+
@default_front_matter = default_front_matter
|
9
10
|
end
|
10
11
|
|
11
12
|
def import
|
@@ -20,7 +21,7 @@ module Jekyll
|
|
20
21
|
|
21
22
|
return if file_last_updated >= page.last_edited_time
|
22
23
|
end
|
23
|
-
|
24
|
+
|
24
25
|
Jekyll.logger.info("Jekyll Notion Import:", "Import #{file_name}")
|
25
26
|
|
26
27
|
write_file
|
@@ -50,18 +51,18 @@ module Jekyll
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def collection_directory
|
53
|
-
@collection_directory ||= "_#{collection_name}"
|
54
|
+
@collection_directory ||= "_#{collection_name}"
|
54
55
|
end
|
55
56
|
|
56
57
|
def front_matter
|
57
58
|
@front_matter ||= YAML.dump(
|
58
|
-
page.props.transform_values {|v| v.is_a?(DateTime) ? v.iso8601 : v}
|
59
|
+
Hash(default_front_matter).merge(page.props.transform_values {|v| v.is_a?(DateTime) ? v.iso8601 : v})
|
59
60
|
) + "---\n\n"
|
60
61
|
end
|
61
62
|
|
62
63
|
private
|
63
64
|
|
64
|
-
attr_reader :page, :collection_name
|
65
|
+
attr_reader :page, :collection_name, :default_front_matter
|
65
66
|
end
|
66
67
|
end
|
67
|
-
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-notion-import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Hall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '13.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '13.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '0'
|
162
162
|
requirements: []
|
163
|
-
rubygems_version: 3.
|
163
|
+
rubygems_version: 3.3.26
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: Import posts from notion
|