Use title, when present, as root ancestor of entries instead of file path

This commit is contained in:
Debanjum Singh Solanky
2023-11-17 14:47:06 -08:00
parent ddb07def0d
commit 55785d50c3
3 changed files with 20 additions and 12 deletions

View File

@@ -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)

View File

@@ -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):
"""