website/public/posts/index.html

67 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./css.css">
<style>
#content {
grid-template-areas:
"header header2"
"content content"
"footer2 footer"
;
grid-template-columns: 1fr 1fr;
}
img {
background-color: var(--background-text);
}
</style>
</head>
<body style="background-color: #222;">
<div id="content">
<div class="header" style="grid-area: header; text-align: center">
<a href="/" style="color: inherit; text-decoration: inherit"><h1>SpoodyThe<span style="color:var(--background-text)">.</span>One</h1></a>
</div>
<div class="content" style="grid-area: content; text-align: left">
</div>
<div class="footer" style="grid-area: footer; text-align: center">
<h4><a href="#">Back to the top</a></h4>
</div>
</div>
<div id="background"></div>
<script src="/main.js"></script>
<script src="/md2html.js"></script>
<script>
(async () => {
// let terms = "Functions Vectors Evaluate Isolate Solve Matrix Tensor Calculus Derivation Limit Procedures Scopes Statements Interpreter Parser Lexer".split(" ");
// generate_background(terms);
// document.querySelector(".header").innerHTML = md2html({{}});
try {
let post = new URLSearchParams(window.location.search).get("post");
let response = await fetch(`/posts/${post}.md`);
let content = await response.text();
if (response.status != 200) {
content = `Error Exception Null\n#Unknown post '${post}'`
}
let lines = content.split("\n");
let terms = lines.shift();
content = lines.join("\n");
generate_background(terms.split(" "));
document.getElementsByClassName("content")[0].innerHTML = tokens2html(md2tokens(content));
} catch (e) {
document.getElementsByClassName("content")[0].innerText = e;
throw e;
}
})()
</script>
</body>
</html>