better page listing
This commit is contained in:
parent
17d5fd25e5
commit
c470fe9c5e
5 changed files with 26 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
export default {
|
export default {
|
||||||
welcome: [
|
index: [
|
||||||
" ________ __ ",
|
" ________ __ ",
|
||||||
"| | | |.-----.| |.----.-----.--------.-----.",
|
"| | | |.-----.| |.----.-----.--------.-----.",
|
||||||
"| | | || -__|| || __| _ | | -__|",
|
"| | | || -__|| || __| _ | | -__|",
|
||||||
|
|
|
@ -113,10 +113,21 @@ export default function useTerminal(inputEl: HTMLTextAreaElement, commands: Simp
|
||||||
setFooter(userCommand.uris)
|
setFooter(userCommand.uris)
|
||||||
}
|
}
|
||||||
|
|
||||||
function listPages() {
|
|
||||||
const specialPages = ['README', 'not_found']
|
const specialPages = ['README', 'not_found']
|
||||||
const pageTitles = pages.map(p => p.frontmatter.title).filter(t => t?.length && !specialPages.includes(t))
|
const knownPages = []
|
||||||
addLine(`Following pages are available:\n\n${pageTitles.join('\n')}\n\nUse the go command to switch pages.`)
|
|
||||||
|
function fillKnownPages() {
|
||||||
|
pages.forEach(p => {
|
||||||
|
const title = p.frontmatter.title
|
||||||
|
if (!title?.length || specialPages.includes(title)) return
|
||||||
|
if (knownPages.includes(title)) return // no duplicates, please
|
||||||
|
knownPages.push(title)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function listPages() {
|
||||||
|
if (knownPages.length === 0) fillKnownPages()
|
||||||
|
addLine(`Following pages are available:\n\n${knownPages.join('\n')}\n\nUse the go command to switch pages.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openPage(page: string) {
|
async function openPage(page: string) {
|
||||||
|
|
9
cv.md
9
cv.md
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
title: 'resume'
|
|
||||||
content: [
|
|
||||||
'This is my CV',
|
|
||||||
'stuff',
|
|
||||||
'foo',
|
|
||||||
'bar',
|
|
||||||
]
|
|
||||||
---
|
|
1
cv.md
Symbolic link
1
cv.md
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
resume.md
|
2
index.md
2
index.md
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: 'welcome'
|
title: 'index'
|
||||||
---
|
---
|
||||||
This is the homepage of Norman Köhring,
|
This is the homepage of Norman Köhring,
|
||||||
a programmer, OpenSource enthusiast and hacker based in Berlin, Germany.
|
a programmer, OpenSource enthusiast and hacker based in Berlin, Germany.
|
||||||
|
|
9
resume.md
Normal file
9
resume.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: 'resume'
|
||||||
|
content: [
|
||||||
|
'This is my CV',
|
||||||
|
'stuff',
|
||||||
|
'foo',
|
||||||
|
'bar',
|
||||||
|
]
|
||||||
|
---
|
Loading…
Reference in a new issue