bunch o' tresh

This commit is contained in:
liquidex 2023-08-27 19:40:47 +02:00
parent e43d612e3d
commit 06d99bf556
9 changed files with 80 additions and 13 deletions

View file

@ -17,13 +17,13 @@ You have been warned.
To build the website: To build the website:
```sh ```sh
cargo run -p treehouse regenerate cargo run -p treehouse generate
``` ```
This will spit out a directory `target/site` containing the static pages. You're free to use any HTTP server you wish, but for development purposes treehouse includes one in the CLI: This will spit out a directory `target/site` containing the static pages. You're free to use any HTTP server you wish, but for development purposes treehouse includes one in the CLI:
```sh ```sh
cargo run -p treehouse regenerate --serve cargo run -p treehouse generate --serve
``` ```
This will fire up a server on port 8080. No way to change that, sorry. Edit the source code. This will fire up a server on port 8080. No way to change that, sorry. Edit the source code.
@ -31,7 +31,7 @@ This will fire up a server on port 8080. No way to change that, sorry. Edit the
If you're developing, you may wanna use [`cargo-watch`](https://crates.io/crates/cargo-watch): If you're developing, you may wanna use [`cargo-watch`](https://crates.io/crates/cargo-watch):
```sh ```sh
cargo watch -- cargo run -p treehouse regenerate --serve cargo watch -- cargo run -p treehouse generate --serve
``` ```
The website will reload itself automatically if you change any file in the repository. The website will reload itself automatically if you change any file in the repository.

View file

@ -2,7 +2,7 @@
- hello! I am liquidex - hello! I am liquidex
% id = "01H89P3CH8YZY1MTZS3DZGGFKX" % id = "01H89P3CH8YZY1MTZS3DZGGFKX"
+ also known as... (click to expand) + also known as (click to expand)
% id = "01H89P3CH8GAHS8DDW1HHEWA3P" % id = "01H89P3CH8GAHS8DDW1HHEWA3P"
- liquidex (just including this here for linking sake) - liquidex (just including this here for linking sake)

View file

@ -1,6 +1,6 @@
pub mod fix; pub mod fix;
pub mod generate;
mod parse; mod parse;
pub mod regenerate;
use std::path::PathBuf; use std::path::PathBuf;
@ -15,14 +15,14 @@ pub struct ProgramArgs {
#[derive(Subcommand)] #[derive(Subcommand)]
pub enum Command { pub enum Command {
/// Regenerate the website. /// Regenerate the website.
Regenerate(#[clap(flatten)] RegenerateArgs), Generate(#[clap(flatten)] GenerateArgs),
/// Populate missing metadata in blocks. /// Populate missing metadata in blocks.
Fix(#[clap(flatten)] FixArgs), Fix(#[clap(flatten)] FixArgs),
} }
#[derive(Args)] #[derive(Args)]
pub struct RegenerateArgs { pub struct GenerateArgs {
/// Start a web server serving the static files. Useful with `cargo watch`. /// Start a web server serving the static files. Useful with `cargo watch`.
#[clap(short, long)] #[clap(short, long)]
pub serve: bool, pub serve: bool,

View file

@ -3,7 +3,7 @@ use std::path::Path;
use clap::Parser; use clap::Parser;
use cli::{ use cli::{
fix::fix_file_cli, fix::fix_file_cli,
regenerate::{self, regenerate_or_report_error, Paths}, generate::{self, regenerate_or_report_error, Paths},
Command, ProgramArgs, Command, ProgramArgs,
}; };
use log::{error, info}; use log::{error, info};
@ -19,7 +19,7 @@ async fn fallible_main() -> anyhow::Result<()> {
let args = ProgramArgs::parse(); let args = ProgramArgs::parse();
match args.command { match args.command {
Command::Regenerate(regenerate_args) => { Command::Generate(regenerate_args) => {
let dirs = Paths { let dirs = Paths {
target_dir: Path::new("target/site"), target_dir: Path::new("target/site"),
config_file: Path::new("treehouse.toml"), config_file: Path::new("treehouse.toml"),
@ -35,7 +35,7 @@ async fn fallible_main() -> anyhow::Result<()> {
regenerate_or_report_error(&dirs); regenerate_or_report_error(&dirs);
if regenerate_args.serve { if regenerate_args.serve {
regenerate::web_server().await?; generate::web_server().await?;
} }
} }

View file

@ -1,6 +1,13 @@
/* Color scheme. */ /* Color scheme. */
:root { :root {
/* naturally */
--liquidex-brand-blue: #058ef0;
--text-color-light: #55423e;
--link-color-light: #004ec8;
--link-color-visited-light: #6c2380;
--background-color: rgb(255, 253, 246); --background-color: rgb(255, 253, 246);
--text-color: #55423e; --text-color: #55423e;
--link-color: #004ec8; --link-color: #004ec8;
@ -51,6 +58,15 @@ main {
body { body {
background-color: var(--background-color); background-color: var(--background-color);
color: var(--text-color); color: var(--text-color);
scrollbar-color: var(--background-color);
scrollbar-width: auto;
scrollbar-gutter: stable;
}
body::selection {
/* Even though this color doesn't yield the most readable text, browsers */
background-color: var(--liquidex-brand-blue);
} }
/* Set up typography */ /* Set up typography */
@ -127,13 +143,13 @@ em {
p, p,
pre { pre {
margin: 6px 0; margin: 0 0;
} }
h1, h1,
h2, h2,
h3 { h3 {
margin: 12px 0; margin: 4px 0;
} }
/* Lay out elements a little less compactly (actually just have some blank space past the end) */ /* Lay out elements a little less compactly (actually just have some blank space past the end) */
@ -207,6 +223,7 @@ th {
.noscript { .noscript {
padding: 16px; padding: 16px;
background-color: #fde748; background-color: #fde748;
color: var(--text-color-light);
border: 1px solid #6c581c; border: 1px solid #6c581c;
border-radius: 8px; border-radius: 8px;
width: fit-content; width: fit-content;
@ -223,6 +240,19 @@ th {
margin-bottom: 0; margin-bottom: 0;
} }
.noscript a {
color: var(--link-color-light);
}
.noscript a:visited {
color: var(--link-color-visited-light);
}
/* also, webkit. */
#webkit-makes-me-go-insane {
display: none;
}
/* Give the logo on the top some nicer looks */ /* Give the logo on the top some nicer looks */
nav { nav {

View file

@ -11,7 +11,7 @@
--tree-icon-space: 28px; --tree-icon-space: 28px;
/* I have no clue why this works, deal with it */ /* I have no clue why this works, deal with it */
--tree-hover-expansion: 0.01px; --tree-hover-expansion: 6px;
position: relative; position: relative;
} }
@ -21,6 +21,11 @@
cursor: pointer; cursor: pointer;
} }
/* Can webkit not be a dick for once? */
.tree details>summary::-webkit-details-marker {
display: none;
}
.tree li { .tree li {
list-style: none; list-style: none;
@ -80,6 +85,8 @@
background-position: var(--tree-icon-position); background-position: var(--tree-icon-position);
padding-left: var(--tree-icon-space); padding-left: var(--tree-icon-space);
margin-left: calc(- var(--tree-icon-space)); margin-left: calc(- var(--tree-icon-space));
padding-top: var(--tree-hover-expansion);
padding-bottom: var(--tree-hover-expansion);
} }
.tree details[open]>summary { .tree details[open]>summary {

View file

@ -0,0 +1,21 @@
// Detect if we can have crucial functionality (ie. custom elements call constructors).
// This doesn't seem to happen in Epiphany, and possibly also other Webkit-based browsers.
let works = false;
class WebkitMoment extends HTMLLIElement {
constructor() {
super();
works = true;
}
}
customElements.define("th-webkit-moment", WebkitMoment, { extends: "li" });
let willItWorkOrWillItNot = document.createElement("div");
willItWorkOrWillItNot.innerHTML = `<li is="th-webkit-moment"></li>`;
// If my takeoff fails
// tell my mother I'm sorry
let box = document.getElementById("webkit-makes-me-go-insane");
if (!works) {
box.style = "display: block";
}

View file

@ -17,6 +17,7 @@
<script type="module" src="{{ config.site }}/navmap.js"></script> <script type="module" src="{{ config.site }}/navmap.js"></script>
<script type="module" src="{{ config.site }}/static/js/tree.js"></script> <script type="module" src="{{ config.site }}/static/js/tree.js"></script>
<script type="module" src="{{ config.site }}/static/js/usability.js"></script> <script type="module" src="{{ config.site }}/static/js/usability.js"></script>
<script type="module" src="{{ config.site }}/static/js/thanks-webkit.js"></script>
</head> </head>
<body> <body>
@ -50,6 +51,14 @@
</div> </div>
</noscript> </noscript>
<div id="webkit-makes-me-go-insane" class="noscript" role="note">
<p>hey! looks like you're using a weird or otherwise quirky web browser. this basically means, the website will
not work for you correctly. I might fix it in the future but I have very limited time to work on this
website and so don't have an estimate on when that might happen.</p>
<p>in the meantime I suggest switching to <a href="https://firefox.com">something more modern.</a></p>
<p>sorry for the inconvenience!</p>
</div>
<main class="tree"> <main class="tree">
{{{ tree }}} {{{ tree }}}
</main> </main>