feat(parse): extract forge refs from task body
Problem: `parse.body()` had no awareness of forge link tokens, so `gh:user/repo#42` stayed in the description instead of metadata. Solution: add `forge_ref` field to `pending.Metadata` and extend the right-to-left token loop in `body()` to call `forge.parse_ref()` as the final fallback before breaking.
This commit is contained in:
parent
46b87e8f30
commit
3a3e5b0505
1 changed files with 12 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ local config = require('pending.config')
|
||||||
---@field rec? string
|
---@field rec? string
|
||||||
---@field rec_mode? 'scheduled'|'completion'
|
---@field rec_mode? 'scheduled'|'completion'
|
||||||
---@field priority? integer
|
---@field priority? integer
|
||||||
|
---@field forge_ref? pending.ForgeRef
|
||||||
|
|
||||||
---@class pending.parse
|
---@class pending.parse
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
@ -596,7 +597,17 @@ function M.body(text)
|
||||||
metadata.rec = raw_spec
|
metadata.rec = raw_spec
|
||||||
i = i - 1
|
i = i - 1
|
||||||
else
|
else
|
||||||
break
|
local forge = require('pending.forge')
|
||||||
|
local ref = forge.parse_ref(token)
|
||||||
|
if ref then
|
||||||
|
if metadata.forge_ref then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
metadata.forge_ref = ref
|
||||||
|
i = i - 1
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue