( displayText: string | undefined, taskPath: string | undefined, linkPath?: string, taskTitle?: string )
| 56 | } |
| 57 | |
| 58 | export function isImplicitTaskLinkDisplayText( |
| 59 | displayText: string | undefined, |
| 60 | taskPath: string | undefined, |
| 61 | linkPath?: string, |
| 62 | taskTitle?: string |
| 63 | ): boolean { |
| 64 | const normalizedDisplay = normalizePathLikeLabel(displayText) || normalizeSubpathLabel(displayText); |
| 65 | if (!normalizedDisplay || !taskPath) return false; |
| 66 | |
| 67 | const normalizedTaskPath = normalizePathLikeLabel(taskPath); |
| 68 | const normalizedLinkPath = normalizePathLikeLabel(linkPath); |
| 69 | const candidates = new Set<string>([ |
| 70 | normalizedTaskPath, |
| 71 | basename(normalizedTaskPath), |
| 72 | ]); |
| 73 | |
| 74 | if (normalizedLinkPath) { |
| 75 | candidates.add(normalizedLinkPath); |
| 76 | candidates.add(basename(normalizedLinkPath)); |
| 77 | } |
| 78 | |
| 79 | const normalizedSubpath = extractTaskLinkSubpath(linkPath); |
| 80 | if (normalizedSubpath) { |
| 81 | candidates.add(normalizedSubpath); |
| 82 | const formattedSubpath = formatTaskLinkSubpathDisplayText(taskTitle, normalizedSubpath); |
| 83 | if (formattedSubpath) { |
| 84 | candidates.add(formattedSubpath); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | return candidates.has(normalizedDisplay); |
| 89 | } |
| 90 | |
| 91 | export function resolveTaskLinkDisplayText( |
| 92 | displayText: string | undefined, |
no test coverage detected