mirror of
https://github.com/glassflame/glassflame.github.io.git
synced 2024-11-22 16:14:26 +00:00
Failed wikilink support attempt
This commit is contained in:
parent
ef70257b53
commit
ce594624dc
2 changed files with 17 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
import {fileDetails} from "../utils/file.mjs";
|
import {fileDetails, filePath} from "../utils/file.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The body element for the pages viewer, handling most low-level things.
|
* The body element for the pages viewer, handling most low-level things.
|
||||||
|
@ -34,6 +34,21 @@ export class BrowseElement extends HTMLBodyElement {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
urlName(name) {
|
||||||
|
if(name.startsWith(".")) {
|
||||||
|
const path = filePath(name).join("/")
|
||||||
|
return this.urlFor({path})
|
||||||
|
}
|
||||||
|
else if(!name.includes("/")) {
|
||||||
|
const path = `${fileDetails(this.parameters.path).directory}/${name}.md`
|
||||||
|
return this.urlFor({path})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const path = filePath(name).join("/")
|
||||||
|
return this.urlFor({path})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Add a landing page
|
// TODO: Add a landing page
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,7 +69,7 @@ export class WikilinkElement extends CustomElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAnchorElementProperties() {
|
resetAnchorElementProperties() {
|
||||||
this.anchorElement.href = this.browseElement.urlFor({path: this.target})
|
this.anchorElement.href = this.browseElement.urlName(this.target)
|
||||||
this.anchorElement.innerText = this.text
|
this.anchorElement.innerText = this.text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue