hugo-notion 0.1.0.pre.alpha.2 → 0.1.0.pre.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/huno +7 -10
- data/lib/hugo_notion/synchronizer.rb +5 -5
- data/lib/hugo_notion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 998722740c86d07e77edb0bcfa625cf6cd9c956f90a525cf1146604324ed26bd
|
4
|
+
data.tar.gz: 596a6adb5d21930ea0a46beb2a4cd7e1a3d309d18f2dd2ade153e9d8414f70e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44e9c969c40cdcbabcfd0442aa7577b54c31865910dc4cf51a268545f8fd1c76e705c64540e6e678284e48782227cf17dd048ccffd7793d17171b5222ea9f84
|
7
|
+
data.tar.gz: 6269bf536477e430f23912f0cc23e1b5a4a4eeb184e64afb38a918efbd602eb678b0d5776dbb383e960cd42f8d607f11caf703a76be26e62ea253c0fb323d423
|
data/bin/huno
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
notion_page_url = ARGV[0]
|
16
16
|
notion_page_id = URI(notion_page_url).path.match(/-(?<page_id>.*)\z/)['page_id']
|
17
17
|
|
18
|
-
destination_dir = Dir.pwd
|
18
|
+
destination_dir = File.join(Dir.pwd, 'content')
|
19
19
|
if ARGV[1]
|
20
20
|
if Pathname.new(ARGV[1]).absolute?
|
21
21
|
destination_dir = ARGV[1]
|
@@ -24,12 +24,9 @@ if ARGV[1]
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
puts "Done."
|
34
|
-
sleep 10
|
35
|
-
end
|
27
|
+
puts "Syncing posts from Notion..."
|
28
|
+
Synchronizer.run(
|
29
|
+
notion_page_id: notion_page_id,
|
30
|
+
destination_dir: destination_dir
|
31
|
+
)
|
32
|
+
puts "Done."
|
@@ -1,4 +1,4 @@
|
|
1
|
-
env_file_path = File.
|
1
|
+
env_file_path = File.join(Dir.pwd, '.env')
|
2
2
|
if File.exist?(env_file_path)
|
3
3
|
require 'dotenv'
|
4
4
|
Dotenv.load(env_file_path)
|
@@ -62,7 +62,7 @@ class Synchronizer
|
|
62
62
|
existing_page_file_names = Dir.entries(destination_dir).select { |f| !File.directory? f }
|
63
63
|
page_file_names = []
|
64
64
|
notion_blocks.each do |notion_block|
|
65
|
-
notion_block_id =
|
65
|
+
notion_block_id = notion_block['id']
|
66
66
|
|
67
67
|
if notion_block['type'] == 'child_database'
|
68
68
|
notion_child_database_title = notion_block['child_database']['title']
|
@@ -79,11 +79,11 @@ class Synchronizer
|
|
79
79
|
'date' => Time.parse(notion_block['created_time'])
|
80
80
|
}
|
81
81
|
if notion_block['properties']
|
82
|
-
if
|
82
|
+
if notion_block.dig('properties', 'date', 'date', 'start')
|
83
83
|
page_front_matter['date'] = Time.parse(notion_block['properties']['date']['date']['start'])
|
84
84
|
end
|
85
85
|
|
86
|
-
if
|
86
|
+
if notion_block.dig('properties', 'Name', 'title', 0, 'plain_text')
|
87
87
|
page_front_matter['title'] = notion_block['properties']['Name']['title'][0]['plain_text']
|
88
88
|
end
|
89
89
|
end
|
@@ -107,7 +107,7 @@ class Synchronizer
|
|
107
107
|
end
|
108
108
|
|
109
109
|
page_front_matter_yaml = page_front_matter.to_yaml.chomp
|
110
|
-
page_markdown = NotionToMd.convert(
|
110
|
+
page_markdown = NotionToMd.convert(page_id: notion_block_id, token: NOTION_TOKEN)
|
111
111
|
page_content = <<-page_CONTENT
|
112
112
|
#{page_front_matter_yaml}
|
113
113
|
---
|
data/lib/hugo_notion/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hugo-notion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.alpha.
|
4
|
+
version: 0.1.0.pre.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nisanth Chunduru
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|