Escape square brackets in file+heading based org-mode links

This commit is contained in:
Debanjum Singh Solanky 2022-06-17 16:16:42 +03:00
parent 04610f453a
commit 51a43245d3

View file

@ -173,7 +173,9 @@ 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
n.properties['SOURCE'] = f'[[file:{filename}::*{n.Heading()}]]' escaped_filename = filename.replace("[","\[").replace("]","\]")
escaped_heading = n.Heading().replace("[","\[").replace("]","\]")
n.properties['SOURCE'] = f'[[file:{escaped_filename}::*{escaped_heading}]]'
return nodelist return nodelist