Maybe the update stuff is fixed now.
This commit is contained in:
parent
3fe7f52066
commit
3d35990b3e
@ -9,6 +9,7 @@ reflects the current state of the markdown file.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import uuid
|
||||||
import hashlib
|
import hashlib
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
@ -168,6 +169,7 @@ class MarkdownProcessor:
|
|||||||
''', (document_id,))
|
''', (document_id,))
|
||||||
for heading_id, level, title, parent_id, content in self.db_manager.cursor.fetchall():
|
for heading_id, level, title, parent_id, content in self.db_manager.cursor.fetchall():
|
||||||
structure[heading_id] = {
|
structure[heading_id] = {
|
||||||
|
'id': heading_id, # Add this line to include the id in each node
|
||||||
'level': level,
|
'level': level,
|
||||||
'title': title,
|
'title': title,
|
||||||
'parent_id': parent_id,
|
'parent_id': parent_id,
|
||||||
@ -175,13 +177,10 @@ class MarkdownProcessor:
|
|||||||
'children': []
|
'children': []
|
||||||
}
|
}
|
||||||
# Build the tree structure
|
# Build the tree structure
|
||||||
root = {}
|
|
||||||
for id, node in structure.items():
|
for id, node in structure.items():
|
||||||
if node['parent_id'] in structure:
|
if node['parent_id'] in structure:
|
||||||
structure[node['parent_id']]['children'].append(id)
|
structure[node['parent_id']]['children'].append(id)
|
||||||
else:
|
return structure
|
||||||
root[id] = node
|
|
||||||
return root
|
|
||||||
|
|
||||||
def parse_new_structure(self, tokens: List) -> Dict:
|
def parse_new_structure(self, tokens: List) -> Dict:
|
||||||
structure = {}
|
structure = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user