From 18f7e6e7ed243d9a98759c50c90466e8b6c0f02e Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 6 Jun 2024 16:51:26 +0530 Subject: [PATCH] Remove "Path" prefix from org ancestor heading in compiled entry --- .../processor/content/org_mode/org_to_entries.py | 2 +- tests/test_org_to_entries.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/khoj/processor/content/org_mode/org_to_entries.py b/src/khoj/processor/content/org_mode/org_to_entries.py index 2dcaa744..c91c2070 100644 --- a/src/khoj/processor/content/org_mode/org_to_entries.py +++ b/src/khoj/processor/content/org_mode/org_to_entries.py @@ -182,7 +182,7 @@ class OrgToEntries(TextToEntries): # Children nodes do not need ancestors trail as root parent node will have it if not entry_heading: ancestors_trail = " / ".join(parsed_entry.ancestors) or Path(entry_to_file_map[parsed_entry]) - heading = f"* Path: {ancestors_trail}\n{heading}" if heading else f"* Path: {ancestors_trail}." + heading = f"* {ancestors_trail}\n{heading}" if heading else f"* {ancestors_trail}." compiled = heading diff --git a/tests/test_org_to_entries.py b/tests/test_org_to_entries.py index f01f50f3..56be5fa5 100644 --- a/tests/test_org_to_entries.py +++ b/tests/test_org_to_entries.py @@ -50,14 +50,14 @@ def test_entry_split_when_exceeds_max_tokens(): data = { f"{tmp_path}": entry, } - expected_heading = f"* Path: {tmp_path}\n** Heading" + expected_heading = f"* {tmp_path}\n** Heading" # Act # Extract Entries from specified Org files entries = OrgToEntries.extract_org_entries(org_files=data) # Split each entry from specified Org files by max tokens - entries = TextToEntries.split_entries_by_max_tokens(entries, max_tokens=6) + entries = TextToEntries.split_entries_by_max_tokens(entries, max_tokens=5) # Assert assert len(entries) == 2 @@ -139,7 +139,7 @@ longer body line 2.1 f"{tmp_path}": entry, } first_expected_entry = f""" -* Path: {tmp_path} +* {tmp_path} ** Heading 1. body line 1 @@ -148,13 +148,13 @@ longer body line 2.1 """.lstrip() second_expected_entry = f""" -* Path: {tmp_path} +* {tmp_path} ** Heading 2. body line 2 """.lstrip() third_expected_entry = f""" -* Path: {tmp_path} / Heading 2 +* {tmp_path} / Heading 2 ** Subheading 2.1. longer body line 2.1 @@ -192,7 +192,7 @@ body line 3.1 f"{tmp_path}": entry, } first_expected_entry = f""" -* Path: {tmp_path} +* {tmp_path} ** Heading 1. body line 1 @@ -201,7 +201,7 @@ body line 3.1 """.lstrip() second_expected_entry = f""" -* Path: {tmp_path} +* {tmp_path} ** Heading 2. body line 2 @@ -210,7 +210,7 @@ body line 3.1 """.lstrip() third_expected_entry = f""" -* Path: {tmp_path} +* {tmp_path} ** Heading 3. body line 3