Skip to content

Commit 1473218

Browse files
Ignore priority when finding headline by title
1 parent 5338159 commit 1473218

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lua/orgmode/parser/file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function File:find_headlines_by_title(title, exact)
208208
if exact then
209209
pattern = pattern .. '$'
210210
end
211-
return item.title:lower():match(pattern)
211+
return item:get_title():lower():match(pattern)
212212
end, self.sections)
213213
end
214214

lua/orgmode/parser/section.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ end
607607

608608
---@private
609609
function Section:_parse()
610-
self:_parse_todo_keyword()
611610
self.priority = self.line:match(self.todo_keyword.value .. '%s+%[#([A-Z0-9])%]') or ''
611+
self:_parse_todo_keyword()
612612
end
613613

614614
---@private
@@ -634,6 +634,14 @@ function Section:_parse_todo_keyword()
634634
}
635635
end
636636

637+
function Section:get_title()
638+
if not self:has_priority() then
639+
return self.title
640+
end
641+
local title = self.title:gsub('^%[#([A-Z0-9])%]%s*', '')
642+
return title
643+
end
644+
637645
function Section:_update_date(date, new_date)
638646
date = date:set({
639647
year = new_date.year,

0 commit comments

Comments
 (0)