jekyll-notion 0.2.0 → 0.2.1

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: '051289989a623c954ef76ca1299a79a4499649dea4b94dfe49ac75f9a67d4bbc'
4
- data.tar.gz: 5de9f6860672c7eb8cdc355b5c5af3257fdc476cba3a5d20b4a420f330189f7e
3
+ metadata.gz: 1c220aa475033e8ddb50ef928b9104c3b8d5da793bbe777062783eb5fbd1491e
4
+ data.tar.gz: c99b1e1b3cebbc00420d8b857e545fa9ae6ac83aad4da110fabf780a0c42a816
5
5
  SHA512:
6
- metadata.gz: 211bcfcf58c3d5e0d1e9d684a7a8483e31882e9b2d81df5e8770a24a62ed7c82334d9481a9138dc6c3285fa3e0585facca6f2f68bcbb1b6d769595c5d9051774
7
- data.tar.gz: 3d5d03c0223c1e891f5ba1102defb082638b67bd9e07cbfc56e2beeadc93e650ed8b2b758543a0a8afe6f8c36a2ad6ca33dd300955fbbc009b7260e509a7e21d
6
+ metadata.gz: 74c1c36de04d025b121fce5634bfdd739796880208114e1dcdac9f49ec2302b16188f54abb1f8bafc07b3911627a2753e6e6c8d750559384ea9bfb94f1c25cb0
7
+ data.tar.gz: a42ae853c9371cd60ffd6e4cd00cc47e02c9eee64d44579ec1ea88f1e4c0e64208a536cec7bc2fea0c6ab1b6ea00b6dcdde23d5aa1110190b48e7e3b6bceabc3
data/README.md CHANGED
@@ -45,6 +45,10 @@ notion:
45
45
  You can also define multiple databases as follows.
46
46
 
47
47
  ```yml
48
+ collections:
49
+ - recipes
50
+ - films
51
+
48
52
  notion:
49
53
  databases:
50
54
  - id: b0e688e1-99af-4295-ae80-b67eb52f2e2f
@@ -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
- "#{Dir.pwd}/_#{current_db.collection}/#{make_filename}",
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllNotion
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  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.0
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-06 00:00:00.000000000 Z
11
+ date: 2022-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport