From 3d35990b3eb95521348cd26e26c875358f2d975e Mon Sep 17 00:00:00 2001 From: kalzu rekku Date: Fri, 4 Oct 2024 21:16:00 +0300 Subject: [PATCH] Maybe the update stuff is fixed now. --- markdown_sqlite.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/markdown_sqlite.py b/markdown_sqlite.py index 0ae8861..cefbf6d 100644 --- a/markdown_sqlite.py +++ b/markdown_sqlite.py @@ -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 = {}