working state

This commit is contained in:
WanderingPenwing 2024-09-02 16:00:17 +02:00
parent 933d9fc1e3
commit ba25617391
4 changed files with 51 additions and 5 deletions

46
pages/common.html Normal file
View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Yuya</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Penwing's Website">
<link rel="stylesheet" href="/assets/style.css">
<link rel="icon" href="/assets/flake.png" type="image/png">
</head>
<body>
<div class="sidenav">
<h3><a href="/">Summary</a></h3>
<h3><a href="/tools">Tools</a></h3>
<a class="description" href="/tools#nginx">proxy</a>
<a class="description" href="/tools#cloudflare">domain</a>
<a class="description" href="/tools#portainer">dashboard</a>
<a class="description" href="/tools#pihole">adblocker</a>
<a class="description" href="/tools#searxng">search</a>
<a class="description" href="/tools#forgejo">git server</a>
<a class="description" href="/tools#jellyfin">streaming</a>
<a class="description" href="/tools#stirling">pdf edit</a>
<a class="description" href="/tools#seafile">storage</a>
<h3><a href="https://www.penwing.org/art.html">my Art</a></h3>
<h3><a href="https://www.penwing.org/games.html">my Games</a></h3>
</div>
<p class="topbar">
<a href="/">Home</a> -
<a href="/tools">Tools</a> -
<a href="/art">Art</a> -
<a href="/games">Games</a>
</p>
<div class="main">
#CONTENT#
<p id="spacer"><br></p>
<hr>
<p id="spacer"><br></p>
<h2 id="epilogue">Epilogue</h2>
<p>Inspired by the geniuses behind <a href="https://perfectmotherfuckingwebsite.com/">perfectwebsite.com</a>,
because a webpage does not have to be heavier than <a href="https://github.com/chrislgarry/Apollo-11">the code that took us to the moon</a>.</p>
<p>This page is licensed under <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a></p>
</div>
</body></html>

View file

@ -1,4 +1,4 @@
# The Igloo ❄
# Yuya
Welcome to *penwing's* website.

View file

@ -1,4 +1,4 @@
# The Igloo - Tools
# Yuya - Tools
###### nginx

View file

@ -11,7 +11,6 @@ fn slugify(text: &str) -> String {
fn markdown_to_html(markdown_content: &str) -> String {
let parser = Parser::new(markdown_content);
let mut html_output = String::new();
let mut events = Vec::new();
let mut in_header = false;
let mut header_text = String::new();
@ -47,13 +46,13 @@ fn markdown_to_html(markdown_content: &str) -> String {
async fn serve_markdown(file_path: &str) -> impl Responder {
// Read the Markdown file
let markdown_content = fs::read_to_string(file_path).unwrap_or_else(|_| String::from("Error reading file"));
let markdown_content = fs::read_to_string(file_path).unwrap_or_else(|_| String::from("Error reading markdown file"));
// Convert Markdown to HTML
let html_content = markdown_to_html(&markdown_content);
// Create the common HTML wrapper
let common_html = include_str!("common.html");
let common_html = fs::read_to_string("pages/common.html").unwrap_or_else(|_| String::from("Error reading html file"));
// Replace #CONTENT# placeholder with the actual Markdown HTML content
let page_html = common_html.replace("#CONTENT#", &html_content);
@ -61,6 +60,7 @@ async fn serve_markdown(file_path: &str) -> impl Responder {
HttpResponse::Ok().content_type("text/html").body(page_html)
}
async fn summary() -> impl Responder {
serve_markdown("pages/summary.md").await
}