inline scripts

This commit is contained in:
Jacky Zhao
2023-06-03 15:07:19 -04:00
parent fcd81353f8
commit 4bdc17d4a1
19 changed files with 187 additions and 69 deletions

View File

@ -22,11 +22,15 @@ export function slugify(s: string): string {
// resolve /a/b/c to ../../
export function resolveToRoot(slug: string): string {
let fp = slug
if (fp.endsWith("/index")) {
fp = fp.slice(0, -"/index".length)
if (fp.endsWith("index")) {
fp = fp.slice(0, -"index".length)
}
return fp
if (fp === "") {
return "."
}
return "./" + fp
.split('/')
.filter(x => x !== '')
.map(_ => '..')