Ignore empty #+TITLE, merge multiple #+TITLE for 0th level headings

This commit is contained in:
Debanjum Singh Solanky
2022-09-10 15:22:26 +03:00
parent 2b58218b56
commit 976397bd82
2 changed files with 101 additions and 3 deletions

View File

@@ -118,8 +118,14 @@ def makelist(filename):
for kw in kwlist: todos[kw] = ""
# Set file title to TITLE property, if it exists
if line[:8] == "#+TITLE:":
file_title = line[8:].strip()
title_search = re.search(r'^#\+TITLE:\s*(.*)$', line)
if title_search and title_search.group(1).strip() != '':
title_text = title_search.group(1).strip()
if file_title == f'{filename}':
file_title = title_text
else:
file_title += f' {title_text}'
continue
# Ignore Properties Drawers Completely
if re.search(':PROPERTIES:', line):