Maybe the update stuff is fixed now.

This commit is contained in:
kalzu rekku 2024-10-04 21:16:00 +03:00
parent 3fe7f52066
commit 3d35990b3e

View File

@ -9,6 +9,7 @@ reflects the current state of the markdown file.
import os
import sqlite3
import uuid
import hashlib
import argparse
import logging
@ -168,6 +169,7 @@ class MarkdownProcessor:
''', (document_id,))
for heading_id, level, title, parent_id, content in self.db_manager.cursor.fetchall():
structure[heading_id] = {
'id': heading_id, # Add this line to include the id in each node
'level': level,
'title': title,
'parent_id': parent_id,
@ -175,13 +177,10 @@ class MarkdownProcessor:
'children': []
}
# Build the tree structure
root = {}
for id, node in structure.items():
if node['parent_id'] in structure:
structure[node['parent_id']]['children'].append(id)
else:
root[id] = node
return root
return structure
def parse_new_structure(self, tokens: List) -> Dict:
structure = {}