mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 05:39:12 +00:00
Use title, when present, as root ancestor of entries instead of file path
This commit is contained in:
@@ -110,7 +110,7 @@ class OrgToEntries(TextToEntries):
|
||||
|
||||
compiled = heading
|
||||
if state.verbose > 2:
|
||||
logger.debug(f"Title: {parsed_entry.heading}")
|
||||
logger.debug(f"Title: {heading}")
|
||||
|
||||
if parsed_entry.tags:
|
||||
tags_str = " ".join(parsed_entry.tags)
|
||||
|
||||
@@ -80,7 +80,7 @@ def makelist(file, filename):
|
||||
} # populated from #+SEQ_TODO line
|
||||
level = ""
|
||||
heading = ""
|
||||
ancestor_headings = [f"{filename}"]
|
||||
ancestor_headings = []
|
||||
bodytext = ""
|
||||
introtext = ""
|
||||
tags = list() # set of all tags in headline
|
||||
@@ -257,6 +257,9 @@ def makelist(file, filename):
|
||||
n.priority = priority_search.group(1)
|
||||
n.heading = priority_search.group(2)
|
||||
|
||||
# Prefix filepath/title to ancestors
|
||||
n.ancestors = [file_title] + n.ancestors
|
||||
|
||||
# Set SOURCE property to a file+heading based org-mode link to the entry
|
||||
if n.level == 0:
|
||||
n.properties["LINE"] = f"file:{normalize_filename(filename)}::0"
|
||||
@@ -295,15 +298,20 @@ class Orgnode(object):
|
||||
self._logbook = list() # List of clock-in, clock-out tuples representing logbook entries
|
||||
self._ancestor_headings = ancestor_headings.copy()
|
||||
|
||||
# Look for priority in headline and transfer to prty field
|
||||
|
||||
@property
|
||||
def ancestors(self):
|
||||
def ancestors(self) -> List[str]:
|
||||
"""
|
||||
Return the Heading text of the node without the TODO tag
|
||||
Return the ancestor headings of the node
|
||||
"""
|
||||
return self._ancestor_headings
|
||||
|
||||
@ancestors.setter
|
||||
def ancestors(self, new_ancestors):
|
||||
"""
|
||||
Update the ancestor headings of the node
|
||||
"""
|
||||
self._ancestor_headings = new_ancestors
|
||||
|
||||
@property
|
||||
def heading(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user