(templateReference: string, sourcePath: string)
| 382 | } |
| 383 | |
| 384 | private resolveTemplateFile(templateReference: string, sourcePath: string) { |
| 385 | const linkPath = parseLinkToPath(templateReference).trim(); |
| 386 | if (!linkPath) { |
| 387 | return null; |
| 388 | } |
| 389 | |
| 390 | const resolvedFile = |
| 391 | this.plugin.app.metadataCache.getFirstLinkpathDest?.(linkPath, sourcePath) ?? |
| 392 | this.plugin.app.metadataCache.getFirstLinkpathDest?.( |
| 393 | linkPath.replace(/\.md$/i, ""), |
| 394 | sourcePath |
| 395 | ) ?? |
| 396 | this.plugin.app.metadataCache.getFirstLinkpathDest?.(linkPath, ""); |
| 397 | if (resolvedFile instanceof TFile) { |
| 398 | return resolvedFile; |
| 399 | } |
| 400 | |
| 401 | const normalizedPath = normalizePath(linkPath); |
| 402 | const candidatePaths = /\.md$/i.test(normalizedPath) |
| 403 | ? [normalizedPath] |
| 404 | : [`${normalizedPath}.md`, normalizedPath]; |
| 405 | |
| 406 | for (const candidatePath of candidatePaths) { |
| 407 | const file = this.plugin.app.vault.getAbstractFileByPath(candidatePath); |
| 408 | if (file instanceof TFile) { |
| 409 | return file; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | return null; |
| 414 | } |
| 415 | |
| 416 | private buildOccurrenceTemplateData( |
| 417 | occurrenceTask: TaskInfo, |
no test coverage detected