notion_to_md 2.3.1 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/notion_to_md/blocks/types.rb +2 -2
- data/lib/notion_to_md/page.rb +24 -4
- data/lib/notion_to_md/page_property.rb +10 -1
- data/lib/notion_to_md/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2c563b14bee2d927bd6f37cbbc18f59f52545bdc02bcb74e865657231a8d926
|
4
|
+
data.tar.gz: e99d9b5e01e3c042e26818ea5eb8b7652701fca9d3a1d94f1c4b5cc41efdca8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f523319dad22eeae015ab2e52bbd24f04d34acf9f654e4d92a9dcebed1e3a0255f08d8492af371347d2fc81d3acf24d0ef0e51d3a0708a2d143485056e783b9
|
7
|
+
data.tar.gz: 8d01b8e6d570da473aa38eb32391f26841ec49e75809ea5733f94974a37a495d731200f3c24a2e3909579ee9ffc1d7d3fcb8b1523fb3070a9d87a711af2be8d9
|
data/README.md
CHANGED
@@ -102,6 +102,10 @@ created_time: 2022-01-23T12:31:00.000Z
|
|
102
102
|
last_edited_time: 2022-01-23T12:31:00.000Z
|
103
103
|
icon: 💥
|
104
104
|
archived: false
|
105
|
+
created_by_id: db313571-0280-411f-a6de-70e826421d16
|
106
|
+
created_by_object: user
|
107
|
+
last_edited_by_id: db313571-0280-411f-a6de-70e826421d16
|
108
|
+
last_edited_by_object: user
|
105
109
|
---
|
106
110
|
```
|
107
111
|
|
@@ -5,7 +5,7 @@ module NotionToMd
|
|
5
5
|
class Types
|
6
6
|
class << self
|
7
7
|
def paragraph(block)
|
8
|
-
return blank if block
|
8
|
+
return blank if block[:rich_text].empty?
|
9
9
|
|
10
10
|
convert_text(block)
|
11
11
|
end
|
@@ -124,7 +124,7 @@ module NotionToMd
|
|
124
124
|
href = text[:href]
|
125
125
|
return content if href.nil?
|
126
126
|
|
127
|
-
"[#{content}](#{href})"
|
127
|
+
"[#{content}](#{CGI.unescape(href)})"
|
128
128
|
end
|
129
129
|
|
130
130
|
def add_annotations(text, content)
|
data/lib/notion_to_md/page.rb
CHANGED
@@ -31,11 +31,27 @@ module NotionToMd
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def created_time
|
34
|
-
|
34
|
+
page['created_time']
|
35
|
+
end
|
36
|
+
|
37
|
+
def created_by_object
|
38
|
+
page.dig(:created_by, :object)
|
39
|
+
end
|
40
|
+
|
41
|
+
def created_by_id
|
42
|
+
page.dig(:created_by, :id)
|
35
43
|
end
|
36
44
|
|
37
45
|
def last_edited_time
|
38
|
-
|
46
|
+
page['last_edited_time']
|
47
|
+
end
|
48
|
+
|
49
|
+
def last_edited_by_object
|
50
|
+
page.dig(:last_edited_by, :object)
|
51
|
+
end
|
52
|
+
|
53
|
+
def last_edited_by_id
|
54
|
+
page.dig(:last_edited_by, :id)
|
39
55
|
end
|
40
56
|
|
41
57
|
def url
|
@@ -83,8 +99,12 @@ module NotionToMd
|
|
83
99
|
'created_time' => created_time,
|
84
100
|
'cover' => cover,
|
85
101
|
'icon' => icon,
|
86
|
-
'last_edited_time' => last_edited_time
|
87
|
-
'archived' => archived
|
102
|
+
'last_edited_time' => last_edited_time,
|
103
|
+
'archived' => archived,
|
104
|
+
'created_by_object' => created_by_object,
|
105
|
+
'created_by_id' => created_by_id,
|
106
|
+
'last_edited_by_object' => last_edited_by_object,
|
107
|
+
'last_edited_by_id' => last_edited_by_id
|
88
108
|
}
|
89
109
|
end
|
90
110
|
|
@@ -75,7 +75,16 @@ module NotionToMd
|
|
75
75
|
# - end
|
76
76
|
# - time_zone
|
77
77
|
def date(prop)
|
78
|
-
prop.dig(:date, :start)
|
78
|
+
date = prop.dig(:date, :start)
|
79
|
+
|
80
|
+
case date
|
81
|
+
when Date
|
82
|
+
date.to_time
|
83
|
+
when String
|
84
|
+
Time.parse(date)
|
85
|
+
else
|
86
|
+
date # Time or nil
|
87
|
+
end
|
79
88
|
rescue NoMethodError
|
80
89
|
nil
|
81
90
|
end
|
data/lib/notion_to_md/version.rb
CHANGED