Implement styling

rust
Elnu 2 years ago
parent 25906df967
commit ccba51e277

107
Cargo.lock generated

@ -235,6 +235,12 @@ version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "bytecount"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
[[package]]
name = "byteorder"
version = "1.4.3"
@ -1255,6 +1261,12 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.7.1"
@ -1350,6 +1362,36 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "nom_locate"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1e299bf5ea7b212e811e71174c5d1a5d065c4c0ad0c8691ecb1f97e3e66025e"
dependencies = [
"bytecount",
"memchr",
"nom",
]
[[package]]
name = "normpath"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04aaf5e9cb0fbf883cc0423159eacdf96a9878022084b35c462c428cab73bcaf"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "normpath"
version = "1.1.1"
@ -1405,6 +1447,38 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "num-bigint"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
@ -1937,7 +2011,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "276cac97fcddca93d741a4a530f58969f45a5bdb587f8c6b04c75cf849ca7f4c"
dependencies = [
"glob",
"normpath",
"normpath 1.1.1",
"notify 5.2.0",
"rocket 0.5.0-rc.3",
"tera",
@ -1987,6 +2061,23 @@ dependencies = [
"uncased",
]
[[package]]
name = "rsass"
version = "0.25.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ab003a9ff922b4d7b1f5f383bc54645887ad278f534dfc65e071096fcb30023"
dependencies = [
"fastrand",
"lazy_static",
"nom",
"nom_locate",
"num-bigint",
"num-integer",
"num-rational",
"num-traits",
"tracing",
]
[[package]]
name = "rustix"
version = "0.37.19"
@ -2028,6 +2119,19 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "sass-rocket-fairing"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d28e2ca5de41fca4b254204d186f0bc15cc09ecc00f807cf1af20c4f0209237d"
dependencies = [
"normpath 0.3.2",
"notify 4.0.17",
"rocket 0.5.0-rc.3",
"rsass",
"walkdir",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
@ -2259,6 +2363,7 @@ dependencies = [
"rocket 0.5.0-rc.3",
"rocket_contrib",
"rocket_dyn_templates",
"sass-rocket-fairing",
"serde",
"serde_yaml",
]

@ -11,5 +11,6 @@ comrak = "0.18.0"
rocket = "=0.5.0-rc.3"
rocket_contrib = { version = "0.4.11", features = ["templates"] }
rocket_dyn_templates = { version = "0.1.0-rc.3", features = ["tera"] }
sass-rocket-fairing = "0.2.0"
serde = "1.0.163"
serde_yaml = "0.9.21"

@ -1,2 +1,4 @@
[default]
template_dir = "templates"
template_dir = "templates"
sass_dir = "styles/sass"
css_dir = "styles/css"

@ -2,8 +2,10 @@
extern crate rocket;
use core::panic;
use rocket::fs::{FileServer, relative};
use rocket_dyn_templates::{context, Template};
use std::fs;
use sass_rocket_fairing::SassFairing;
mod challenge;
use challenge::Challenge;
@ -52,5 +54,7 @@ fn rocket() -> _ {
let config = rocket::Config::figment().merge(("port", 1313));
rocket::custom(config)
.mount("/", routes![get_challenge])
.mount("/css", FileServer::from(relative!("styles/css")))
.attach(Template::fairing())
.attach(SassFairing::default())
}

@ -0,0 +1 @@
*.css

@ -0,0 +1,34 @@
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background: #1e1e2e;
color: #c6d0f5;
}
b, strong {
color: #eff1f5;
}
a {
text-decoration: none;
&:hover {
border-bottom: 2px solid;
}
&.noun {
color: #a6e3a1;
}
&.adjective {
color: #f38ba8;
}
&.verb {
color: #87b0f9;
}
&.adverb {
color: #94e2d5;
}
&.particle {
color: #f9e2af;
}
&.phrase {
color: #fab387;
}
}

@ -2,6 +2,7 @@
<html>
<head>
<title>Tegaki Tuesday</title>
<link href="/css/style.css" rel="stylesheet">
</head>
<body>
<h1>Welcome to Tegaki Tuesday #{{ challenge }}!</h1>
@ -13,7 +14,7 @@
<p>
{% for word in subline %}
{% if word.dictionary %}
<a href="{{ word.dictionary }}" target="_blank"{% if word.pos %} class="{{ word.pos }}"{% endif %}>
<a href="{{ word.dictionary }}" target="_blank"{% if word.pos %} class="{{ word.pos }}" title="{{ word.pos }}"{% endif %}>
{% endif %}
{% for segment in word.text %}
<ruby>{{ segment.kanji }}<rp>(</rp><rt>{{ segment.furigana | safe }}</rt><rp>)</rp></ruby>

Loading…
Cancel
Save