mirror of
https://github.com/RGBCube/Site
synced 2025-08-01 13:37:49 +00:00
Add about page
This commit is contained in:
parent
517c2ce99e
commit
d03a5224a1
8 changed files with 224 additions and 71 deletions
168
Cargo.lock
generated
168
Cargo.lock
generated
|
@ -242,6 +242,21 @@ dependencies = [
|
|||
"alloc-no-stdlib",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.5"
|
||||
|
@ -412,6 +427,20 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.13"
|
||||
|
@ -475,6 +504,12 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.12"
|
||||
|
@ -656,6 +691,15 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getopts"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.11"
|
||||
|
@ -749,6 +793,29 @@ version = "2.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.5.0"
|
||||
|
@ -795,6 +862,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "language-tags"
|
||||
version = "0.3.2"
|
||||
|
@ -933,6 +1009,15 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.2"
|
||||
|
@ -1058,6 +1143,18 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"getopts",
|
||||
"memchr",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.35"
|
||||
|
@ -1261,6 +1358,7 @@ dependencies = [
|
|||
"anyhow",
|
||||
"bytes",
|
||||
"cargo_toml",
|
||||
"chrono",
|
||||
"clap",
|
||||
"embed",
|
||||
"env_logger",
|
||||
|
@ -1268,6 +1366,7 @@ dependencies = [
|
|||
"maud",
|
||||
"mime_guess",
|
||||
"minify-js",
|
||||
"pulldown-cmark",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1497,6 +1596,12 @@ dependencies = [
|
|||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.0"
|
||||
|
@ -1526,6 +1631,60 @@ version = "0.11.0+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -1557,6 +1716,15 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
|
|
|
@ -13,6 +13,7 @@ actix-web = "4.4.1"
|
|||
anyhow = "1.0.77"
|
||||
bytes = "1.5.0"
|
||||
cargo_toml = "0.17.2"
|
||||
chrono = "0.4.31"
|
||||
clap = { version = "4.4.12", features = [ "derive" ] }
|
||||
embed = { git = "https://github.com/RGBCube/embed-rs" }
|
||||
env_logger = "0.10.1"
|
||||
|
@ -20,6 +21,7 @@ log = { version = "0.4.20", features = [ "serde" ] }
|
|||
maud = { version = "0.25.0", features = [ "actix-web" ] }
|
||||
mime_guess = "2.0.4"
|
||||
minify-js = "0.6.0"
|
||||
pulldown-cmark = "0.9.3"
|
||||
|
||||
[patch.crates-io]
|
||||
proc-macro2 = { git = "https://github.com/RGBCube/proc-macro2" }
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
mod asset;
|
||||
mod errors;
|
||||
mod markdown;
|
||||
mod minify;
|
||||
mod page;
|
||||
mod routes;
|
||||
|
|
18
src/markdown.rs
Normal file
18
src/markdown.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
use maud::{
|
||||
Markup,
|
||||
PreEscaped,
|
||||
};
|
||||
use pulldown_cmark::{
|
||||
html,
|
||||
Options,
|
||||
Parser,
|
||||
};
|
||||
|
||||
pub fn parse(markdown: &str) -> Markup {
|
||||
let mut output = String::new();
|
||||
|
||||
let parser = Parser::new_ext(markdown, Options::all());
|
||||
html::push_html(&mut output, parser);
|
||||
|
||||
PreEscaped(output)
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
use std::{
|
||||
env,
|
||||
path::PathBuf,
|
||||
use chrono::{
|
||||
Datelike,
|
||||
Local,
|
||||
};
|
||||
|
||||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
|
@ -21,7 +20,7 @@ pub fn create(title: Option<&str>, page: Page, body: Markup) -> Markup {
|
|||
(asset::Css::Shared("text.css"))
|
||||
(asset::Css::Owned(format!(r"
|
||||
.{page} {{
|
||||
font-style: italic !important;
|
||||
font-style: italic;
|
||||
}}
|
||||
", page = page.as_str())))
|
||||
},
|
||||
|
@ -37,8 +36,9 @@ pub fn create(title: Option<&str>, page: Page, body: Markup) -> Markup {
|
|||
(body)
|
||||
|
||||
footer {
|
||||
"Served by "
|
||||
(env::current_exe().unwrap_or_else(|_| PathBuf::from("the toaster in my bathtub")).display())
|
||||
"Copyright © "
|
||||
(Local::now().year())
|
||||
" RGBCube"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@ body {
|
|||
}
|
||||
|
||||
nav {
|
||||
font-size: 150%;
|
||||
font-size: large;
|
||||
|
||||
background-color: white;
|
||||
padding: .3em .6em;
|
||||
|
@ -43,5 +43,10 @@ a:hover {
|
|||
}
|
||||
|
||||
footer {
|
||||
border-top: .15em solid white;
|
||||
display: flex;
|
||||
font-size: small;
|
||||
justify-content: center;
|
||||
margin-bottom: 3em;
|
||||
padding-top: .5em;
|
||||
}
|
3
src/routes/about.md
Normal file
3
src/routes/about.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
### Hi.
|
||||
|
||||
Test 123
|
|
@ -1,12 +1,12 @@
|
|||
use actix_web::get;
|
||||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
};
|
||||
use maud::Markup;
|
||||
|
||||
use crate::page::{
|
||||
use crate::{
|
||||
markdown,
|
||||
page::{
|
||||
text,
|
||||
Page,
|
||||
},
|
||||
};
|
||||
|
||||
#[get("/about")]
|
||||
|
@ -14,50 +14,6 @@ pub async fn handler() -> actix_web::Result<Markup> {
|
|||
Ok(text::create(
|
||||
Some("About"),
|
||||
Page::About,
|
||||
html! {
|
||||
h1 { "Lorem Ipsum" }
|
||||
p {
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eget justo nec libero finibus facilisis. Curabitur fermentum quam et neque faucibus, nec pharetra nunc hendrerit."
|
||||
}
|
||||
h2 { "Section 1" }
|
||||
p {
|
||||
"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec auctor velit id lectus vehicula molestie."
|
||||
}
|
||||
h3 { "Subsection 1.1" }
|
||||
p {
|
||||
"Nullam mollis nunc non nisl fermentum, a varius eros viverra. Fusce condimentum felis vitae nibh vehicula, a tincidunt ipsum eleifend."
|
||||
}
|
||||
h2 { "Section 2" }
|
||||
p {
|
||||
"Phasellus euismod eros a elit volutpat, sed volutpat eros placerat. Sed dictum est et metus consectetur, quis fringilla nunc venenatis."
|
||||
}
|
||||
h3 { "Subsection 2.1" }
|
||||
p {
|
||||
"Integer ac libero id nisi posuere bibendum. Vivamus ut enim auctor, scelerisque quam a, fermentum ligula."
|
||||
}
|
||||
h3 { "Subsection 2.2" }
|
||||
p {
|
||||
"Morbi ut ex vel odio congue lobortis sit amet vel lacus. Duis rhoncus risus eget justo tincidunt vehicula."
|
||||
}
|
||||
h2 { "Section 3" }
|
||||
p {
|
||||
"Etiam quis sapien quis lacus malesuada vestibulum. Nam bibendum risus sed dui maximus, sed posuere lorem ultricies."
|
||||
}
|
||||
h3 { "Subsection 3.1" }
|
||||
p {
|
||||
"Cras interdum arcu at dolor dictum, a posuere urna aliquam. Vestibulum nec tortor nec nunc cursus lobortis sit amet a arcu."
|
||||
}
|
||||
h3 { "Subsection 3.2" }
|
||||
p {
|
||||
"Nunc auctor mauris quis lacus molestie lobortis. Vivamus eu sapien vel ligula congue convallis."
|
||||
}
|
||||
p {
|
||||
a href="#" { "Link 1" }
|
||||
" | "
|
||||
a href="#" { "Link 2" }
|
||||
" | "
|
||||
a href="#" { "Link 3" }
|
||||
}
|
||||
},
|
||||
markdown::parse(embed::string!("about.md").as_ref()),
|
||||
))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue