mirror of
https://github.com/glassflame/glassflame.github.io.git
synced 2024-11-25 17:44: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.
|
||||
|
@ -34,6 +34,21 @@ export class BrowseElement extends HTMLBodyElement {
|
|||
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
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,7 @@ export class WikilinkElement extends CustomElement {
|
|||
}
|
||||
|
||||
resetAnchorElementProperties() {
|
||||
this.anchorElement.href = this.browseElement.urlFor({path: this.target})
|
||||
this.anchorElement.href = this.browseElement.urlName(this.target)
|
||||
this.anchorElement.innerText = this.text
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue