Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions gkeep2notion.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def add_chunk(self, text: str, url: str = ''):
self._chunks.append({
"type": "text",
"text": {
"content": text
"content": text
}
})

Expand Down Expand Up @@ -264,10 +264,21 @@ def parseBlock(p: str) -> dict:

def parseTextToPage(text: str, page: Page):
lines = text.splitlines()
lines.insert(len(lines), '')
last_block = None
print(f"Parsing {len(lines)} blocks")
for p in lines:
for x in range(0, len(lines)):
p = lines[x]
block = parseBlock(p)
page.add_text(block['text'], block['type'])
if last_block:
if last_block['type'] == 'text' and last_block['type'] == block['type'] and len(last_block['text']) + len(
block['text']) < 2000:
last_block['text'] += "\n" + block['text']
if x < len(lines) - 1:
continue
page.add_text(last_block['text'], last_block['type'])
last_block = block



def getNoteCategories(note: node.TopLevelNode) -> list[str]:
Expand Down