jekyll-notion 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/jekyll-notion/generator.rb +21 -10
- data/lib/jekyll-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: 1c220aa475033e8ddb50ef928b9104c3b8d5da793bbe777062783eb5fbd1491e
|
4
|
+
data.tar.gz: c99b1e1b3cebbc00420d8b857e545fa9ae6ac83aad4da110fabf780a0c42a816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c1c36de04d025b121fce5634bfdd739796880208114e1dcdac9f49ec2302b16188f54abb1f8bafc07b3911627a2753e6e6c8d750559384ea9bfb94f1c25cb0
|
7
|
+
data.tar.gz: a42ae853c9371cd60ffd6e4cd00cc47e02c9eee64d44579ec1ea88f1e4c0e64208a536cec7bc2fea0c6ab1b6ea00b6dcdde23d5aa1110190b48e7e3b6bceabc3
|
data/README.md
CHANGED
@@ -23,6 +23,8 @@ module JekyllNotion
|
|
23
23
|
@current_db = NotionDatabase.new(:config => db_config)
|
24
24
|
@current_db.pages.each do |page|
|
25
25
|
@current_page = page
|
26
|
+
next if file_exists?(make_path)
|
27
|
+
|
26
28
|
current_collection.docs << make_page
|
27
29
|
log_new_page
|
28
30
|
end
|
@@ -39,9 +41,14 @@ module JekyllNotion
|
|
39
41
|
@collections ||= {}
|
40
42
|
end
|
41
43
|
|
44
|
+
# Checks if a file already exists in the site source
|
45
|
+
def file_exists?(file_path)
|
46
|
+
File.exist? @site.in_source_dir(file_path)
|
47
|
+
end
|
48
|
+
|
42
49
|
def make_page
|
43
50
|
new_post = DocumentWithoutAFile.new(
|
44
|
-
|
51
|
+
make_path,
|
45
52
|
{ :site => @site, :collection => current_collection }
|
46
53
|
)
|
47
54
|
new_post.content = "#{make_frontmatter}\n\n#{make_md}"
|
@@ -49,6 +56,19 @@ module JekyllNotion
|
|
49
56
|
new_post
|
50
57
|
end
|
51
58
|
|
59
|
+
def make_path
|
60
|
+
"_#{current_db.collection}/#{make_filename}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def make_filename
|
64
|
+
if current_db.collection == "posts"
|
65
|
+
"#{current_page.created_date}-#{Jekyll::Utils.slugify(current_page.title,
|
66
|
+
:mode => "latin")}.md"
|
67
|
+
else
|
68
|
+
"#{current_page.title.downcase.parameterize}.md"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
52
72
|
def make_md
|
53
73
|
NotionToMd::Converter.new(:page_id => current_page.id).convert
|
54
74
|
end
|
@@ -67,15 +87,6 @@ module JekyllNotion
|
|
67
87
|
Jekyll::Utils.deep_merge_hashes(current_page.custom_props, current_page.default_props)
|
68
88
|
end
|
69
89
|
|
70
|
-
def make_filename
|
71
|
-
if current_db.collection == "posts"
|
72
|
-
"#{current_page.created_date}-#{Jekyll::Utils.slugify(current_page.title,
|
73
|
-
:mode => "latin")}.md"
|
74
|
-
else
|
75
|
-
"#{current_page.title.downcase.parameterize}.md"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
90
|
def current_collection
|
80
91
|
@site.collections[current_db.collection]
|
81
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-notion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrique Arias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|