From fea133554b47ac6aef9a55d53e3f694311b10fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 31 May 2021 20:45:13 +0800 Subject: stash --- script/core/searcher.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'script/core/searcher.lua') diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 4063426d..9208032c 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -24,7 +24,7 @@ local ignoredIDs = { local m = {} ----@alias guide.searchmode '"ref"'|'"def"'|'"field"' +---@alias guide.searchmode '"ref"'|'"def"' ---添加结果 ---@param status guide.status @@ -227,7 +227,7 @@ function m.searchRefsByID(status, uri, expect, mode) mark[id] = cmark end log.debug('search:', id, field) - if field then + if field then if cmark[field] then return end @@ -456,12 +456,24 @@ function m.searchRefsByID(status, uri, expect, mode) end end + local function checkCrossUri(id, field) + local targetUri, newID = noder.getUriAndID(id) + if not targetUri then + return false + end + crossSearch(status, targetUri, newID .. (field or ''), mode) + return true + end + local stepCount = 0 function searchStep(id, field) stepCount = stepCount + 1 if stepCount > 1000 then error('too large') end + if checkCrossUri(id, field) then + return + end local node = noder.getNodeByID(root, id) if node then searchNode(id, node, field) -- cgit v1.2.3