(csvRel: string, pages: Record<string, string>)
| 58 | // vault-relative paths (e.g. `Books.base/pages/X.md`). Legacy loose databases |
| 59 | // have no folder, so paths pass through unchanged. |
| 60 | function pagesToFull(csvRel: string, pages: Record<string, string>): Record<string, string> { |
| 61 | const formDir = formDirFromCsvPath(toPosix(csvRel)) |
| 62 | if (!formDir) return pages |
| 63 | const prefix = `${formDir}/` |
| 64 | return Object.fromEntries( |
| 65 | Object.entries(pages).map(([id, p]) => [id, p.startsWith(prefix) ? p : `${prefix}${p}`]) |
| 66 | ) |
| 67 | } |
| 68 | |
| 69 | function pagesToRelative(csvRel: string, pages: Record<string, string>): Record<string, string> { |
| 70 | const formDir = formDirFromCsvPath(toPosix(csvRel)) |
no test coverage detected