From ac9d7464446ed7967bfda658e3ea3bb677e54dca Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 17 Jun 2022 04:21:22 +0300 Subject: [PATCH] Fix Tags extraction in Org Node parser - Previous version required two tags at least to work, not sure why - Fixed it to extract all tags, even if only one tag in heading --- src/processor/org_mode/orgnode.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/processor/org_mode/orgnode.py b/src/processor/org_mode/orgnode.py index d5428e43..50d1f181 100644 --- a/src/processor/org_mode/orgnode.py +++ b/src/processor/org_mode/orgnode.py @@ -83,15 +83,13 @@ def makelist(filename): bodytext = "" tag1 = "" alltags = [] # list of all tags in headline - tagsrch = re.search(r'(.*?)\s*:([a-zA-Z0-9].*?):([a-zA-Z0-9].*?):$',heading) + tagsrch = re.search(r'(.*?)\s*:([a-zA-Z0-9].*?):$',heading) if tagsrch: heading = tagsrch.group(1) - tag1 = tagsrch.group(2) - alltags.append(tag1) - tag2 = tagsrch.group(3) - if tag2: - for t in tag2.split(':'): - if t != '': alltags.append(t) + tags = tagsrch.group(2) + if tags: + for tag in tags.split(':'): + if tag != '': alltags.append(tag) else: # we are processing a non-heading line if line[:10] == '#+SEQ_TODO': kwlist = re.findall(r'([A-Z]+)\(', line)