ci: some fixes
Some checks are pending
quality / changes (push) Waiting to run
quality / Lua Format Check (push) Blocked by required conditions
quality / Lua Lint Check (push) Blocked by required conditions
quality / Lua Type Check (push) Blocked by required conditions
quality / Markdown Format Check (push) Blocked by required conditions
test / Test (Neovim nightly) (push) Waiting to run
test / Test (Neovim stable) (push) Waiting to run

This commit is contained in:
Barrett Ruth 2026-03-13 20:38:29 -04:00
parent 2b75843dab
commit e816e6fb7e
3 changed files with 111 additions and 77 deletions

View file

@ -536,7 +536,6 @@ function M.body(text)
end
local metadata = {}
local i = #tokens
local ck = category_key()
local dk = date_key()
local rk = recur_key()
@ -544,84 +543,82 @@ function M.body(text)
local date_pattern_strict = '^' .. vim.pesc(dk) .. ':(%d%d%d%d%-%d%d%-%d%d[T%d:]*)$'
local date_pattern_any = '^' .. vim.pesc(dk) .. ':(.+)$'
local rec_pattern = '^' .. vim.pesc(rk) .. ':(%S+)$'
local forge_indices = {}
local desc_tokens = {}
local forge_tokens = {}
for _, token in ipairs(tokens) do
local consumed = false
while i >= 1 do
local token = tokens[i]
local due_val = token:match(date_pattern_strict)
if due_val then
if metadata.due then
break
if due_val and is_valid_datetime(due_val) then
if not metadata.due then
metadata.due = due_val
end
if not is_valid_datetime(due_val) then
break
end
metadata.due = due_val
i = i - 1
else
consumed = true
end
if not consumed then
local raw_val = token:match(date_pattern_any)
if raw_val then
if metadata.due then
break
end
local resolved = M.resolve_date(raw_val)
if not resolved then
break
end
metadata.due = resolved
i = i - 1
else
local cat_val = token:match(cat_pattern)
if cat_val then
if metadata.category then
break
if resolved then
if not metadata.due then
metadata.due = resolved
end
consumed = true
end
end
end
if not consumed then
local cat_val = token:match(cat_pattern)
if cat_val then
if not metadata.category then
metadata.category = cat_val
i = i - 1
else
local pri_bangs = token:match('^%+(!+)$')
if pri_bangs then
if metadata.priority then
break
end
local max = config.get().max_priority or 3
metadata.priority = math.min(#pri_bangs, max)
i = i - 1
else
local rec_val = token:match(rec_pattern)
if rec_val then
if metadata.recur then
break
end
local recur = require('pending.recur')
local raw_spec = rec_val
if raw_spec:sub(1, 1) == '!' then
metadata.recur_mode = 'completion'
raw_spec = raw_spec:sub(2)
end
if not recur.validate(raw_spec) then
break
end
metadata.recur = raw_spec
i = i - 1
elseif forge.parse_ref(token) then
table.insert(forge_indices, i)
i = i - 1
else
break
end
end
end
consumed = true
end
end
if not consumed then
local pri_bangs = token:match('^%+(!+)$')
if pri_bangs then
if not metadata.priority then
local max = config.get().max_priority or 3
metadata.priority = math.min(#pri_bangs, max)
end
consumed = true
end
end
if not consumed then
local rec_val = token:match(rec_pattern)
if rec_val then
local recur = require('pending.recur')
local raw_spec = rec_val
if raw_spec:sub(1, 1) == '!' then
raw_spec = raw_spec:sub(2)
end
if recur.validate(raw_spec) then
if not metadata.recur then
metadata.recur_mode = rec_val:sub(1, 1) == '!' and 'completion' or nil
metadata.recur = raw_spec
end
consumed = true
end
end
end
if not consumed then
if forge.parse_ref(token) then
table.insert(forge_tokens, token)
else
table.insert(desc_tokens, token)
end
end
end
local desc_tokens = {}
for j = 1, i do
table.insert(desc_tokens, tokens[j])
end
for fi = #forge_indices, 1, -1 do
table.insert(desc_tokens, tokens[forge_indices[fi]])
for _, ft in ipairs(forge_tokens) do
table.insert(desc_tokens, ft)
end
local description = table.concat(desc_tokens, ' ')