mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Fix minor bugs in OrgNode parser
- Bugs discovered from writing org-node tests
This commit is contained in:
@@ -67,8 +67,8 @@ def makelist(filename):
|
|||||||
for line in f:
|
for line in f:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
hdng = re.search(r'^(\*+)\s(.*?)\s*$', line)
|
hdng = re.search(r'^(\*+)\s(.*?)\s*$', line)
|
||||||
if hdng:
|
if hdng: # we are processing a heading line
|
||||||
if heading: # we are processing a heading line
|
if heading: # if we have are on second heading, append first heading to headings list
|
||||||
thisNode = Orgnode(level, heading, bodytext, tags)
|
thisNode = Orgnode(level, heading, bodytext, tags)
|
||||||
if closed_date:
|
if closed_date:
|
||||||
thisNode.setClosed(closed_date)
|
thisNode.setClosed(closed_date)
|
||||||
@@ -175,7 +175,7 @@ def makelist(filename):
|
|||||||
n.setHeading(prtysrch.group(2))
|
n.setHeading(prtysrch.group(2))
|
||||||
|
|
||||||
# Set SOURCE property to a file+heading based org-mode link to the entry
|
# Set SOURCE property to a file+heading based org-mode link to the entry
|
||||||
escaped_filename = filename.replace("[","\[").replace("]","\]")
|
escaped_filename = f'{filename}'.replace("[","\[").replace("]","\]")
|
||||||
escaped_heading = n.Heading().replace("[","\[").replace("]","\]")
|
escaped_heading = n.Heading().replace("[","\[").replace("]","\]")
|
||||||
n.properties['SOURCE'] = f'[[file:{escaped_filename}::*{escaped_heading}]]'
|
n.properties['SOURCE'] = f'[[file:{escaped_filename}::*{escaped_heading}]]'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user