diff options
| -rw-r--r-- | dhall/characters.dhall | 77 | ||||
| -rw-r--r-- | dhall/package.dhall | 1 | ||||
| -rw-r--r-- | dhall/types/Character.dhall | 19 | ||||
| -rw-r--r-- | dhall/types/Config.dhall | 4 | ||||
| -rw-r--r-- | dhall/types/package.dhall | 1 | ||||
| -rw-r--r-- | lib/xesite_markdown/src/lib.rs | 2 | ||||
| -rw-r--r-- | lib/xesite_templates/src/lib.rs | 2 | ||||
| -rw-r--r-- | src/app/config.rs | 52 | ||||
| -rw-r--r-- | src/handlers/mod.rs | 9 | ||||
| -rw-r--r-- | src/main.rs | 1 | ||||
| -rw-r--r-- | src/tmpl/mod.rs | 19 |
11 files changed, 179 insertions, 8 deletions
diff --git a/dhall/characters.dhall b/dhall/characters.dhall new file mode 100644 index 0000000..fd46b52 --- /dev/null +++ b/dhall/characters.dhall @@ -0,0 +1,77 @@ +let xesite = ./types/package.dhall + +let Prelude = ./Prelude.dhall + +let C = xesite.Character + +let they = ./pronouns/they.dhall + +let characters = + [ C::{ + , name = "Mara" + , stickerName = "mara" + , defaultPose = "hacker" + , description = + "Mara was the first character added to this blog. She is written to be the student in the Socratic dialogues. She has a fair amount of knowledge about technology, just enough to not be afraid to ask for clarification on how things fit into the larger picture or to call the teacher out for being vague or misleading. Mara helps Aoi get up to speed with some topics. Mara is a shark with brown hair that has a red streak." + , stickers = [ "aha", "hacker", "happy", "hmm", "sh0rck", "wat" ] + } + , C::{ + , name = "Cadey" + , stickerName = "cadey" + , defaultPose = "enby" + , description = + "Cadey is written as the teacher in the Socratic dialogues. They started out as a self-insert for the author of this blog to de-emphasize certain points, but then evolved into a way to have interplay between themselves and Mara. They are written as someone who has expertise in the topics being discussed, but doesn't have perfect expertise. They help Mara with answers to questions about details to the topics being discussed and work well with Numa due to being friends for a very long time. Cadey is an orcadragon with pink hair." + , pronouns = they + , stickers = + [ "aha" + , "angy" + , "coffee" + , "enby" + , "facepalm" + , "hug" + , "percussive-maintenance" + , "wat" + ] + } + , C::{ + , name = "Numa" + , stickerName = "numa" + , defaultPose = "delet" + , description = + "Numa is the keeper of firey hot takes. Born in the fires of shitposting and satire, Numa genuinely does care about the topics being discussed, but has a bad habit of communicating in shitposts, memes, and hot takes intentionally designed to make you reconsider how serious she is being about any given topic. She could definitely be a wonderful teacher if she could lessen up a bit on the satire. The stickers for Numa are 3d renders of the author's v-tubing avatar, but Numa is written differently than the characterization of the author when streaming. Numa is a fairly tall (6') human with neon green hair that usually wears it in a high ponytail." + , stickers = + [ "delet" + , "delet2" + , "dismay" + , "happy" + , "neutral" + , "stare" + , "thinking" + , "vibe" + ] + } + , C::{ + , name = "Aoi" + , stickerName = "aoi" + , defaultPose = "cheer" + , description = + "Aoi is the idealist. She is another student type like Mara, but hasn't been marred by the cynicism that can come with experience in this industry. If Mara is a junior in a university going for a programming degree, Aoi would be a freshman. Aoi can feel bullied by misunderstanding Numa's satire as rudeness, but looks up to Mara and Cadey as ideals for where she wants to go in the industry. Aoi is a blue-haired foxgirl." + , stickers = + [ "angy" + , "cheer" + , "coffee" + , "concern" + , "facepalm" + , "grin" + , "happy" + , "rage" + , "sleepy" + , "smug" + , "sus" + , "wut" + , "yawn" + ] + } + ] + +in characters diff --git a/dhall/package.dhall b/dhall/package.dhall index e1e6996..a8a4cc8 100644 --- a/dhall/package.dhall +++ b/dhall/package.dhall @@ -82,4 +82,5 @@ in Config::{ , Link::{ url = "irc://irc.libera.chat/#xeserv", title = "IRC" } ] , pronouns = ./pronouns.dhall + , characters = ./characters.dhall } diff --git a/dhall/types/Character.dhall b/dhall/types/Character.dhall new file mode 100644 index 0000000..c592790 --- /dev/null +++ b/dhall/types/Character.dhall @@ -0,0 +1,19 @@ +let PronounSet = ./PronounSet.dhall + +in { Type = + { name : Text + , stickerName : Text + , defaultPose : Text + , description : Text + , pronouns : PronounSet.Type + , stickers : List Text + } + , default = + { name = "" + , stickerName = "" + , defaultPose = "" + , description = "" + , pronouns = ../pronouns/she.dhall + , stickers = [] : List Text + } + } diff --git a/dhall/types/Config.dhall b/dhall/types/Config.dhall index 245c645..21e541a 100644 --- a/dhall/types/Config.dhall +++ b/dhall/types/Config.dhall @@ -2,6 +2,8 @@ let Person = ./Person.dhall let Author = ./Author.dhall +let Character = ./Character.dhall + let Job = ./Job.dhall let Link = ./Link.dhall @@ -34,6 +36,7 @@ in { Type = , notableProjects : List Link.Type , contactLinks : List Link.Type , pronouns : List PronounSet.Type + , characters : List Character.Type } , default = { signalboost = [] : List Person.Type @@ -49,5 +52,6 @@ in { Type = , notableProjects = [] : List Link.Type , contactLinks = [] : List Link.Type , pronouns = [] : List PronounSet.Type + , characters = [] : List Character.Type } } diff --git a/dhall/types/package.dhall b/dhall/types/package.dhall index 4226d77..4d6377b 100644 --- a/dhall/types/package.dhall +++ b/dhall/types/package.dhall @@ -1,4 +1,5 @@ { Author = ./Author.dhall +, Character = ./Character.dhall , Company = ./Company.dhall , Config = ./Config.dhall , Job = ./Job.dhall diff --git a/lib/xesite_markdown/src/lib.rs b/lib/xesite_markdown/src/lib.rs index 0767c30..008a4ca 100644 --- a/lib/xesite_markdown/src/lib.rs +++ b/lib/xesite_markdown/src/lib.rs @@ -124,7 +124,7 @@ pub fn render(inp: &str) -> Result<String> { <div class="{class}"> <img src="https://cdn.xeiaso.net/sticker/{name_lower}/{mood}/{size}" alt="{name} is {mood}"> </div> - <div class="conversation-chat"><<b>{name}</b>> "# + <div class="conversation-chat"><<a href="/characters#{name_lower}"><b>{name}</b></a>> "# ), ContentType::Html, ); diff --git a/lib/xesite_templates/src/lib.rs b/lib/xesite_templates/src/lib.rs index d6b3abe..a0070f1 100644 --- a/lib/xesite_templates/src/lib.rs +++ b/lib/xesite_templates/src/lib.rs @@ -75,7 +75,7 @@ pub fn conv(name: String, mood: String, body: Markup) -> Markup { } ."conversation-chat" { "<" - b { (name) } + a href={"/characters#" (name_lower)} { b { (name) } } "> " (body) } diff --git a/src/app/config.rs b/src/app/config.rs index d3d93ca..7ea46fd 100644 --- a/src/app/config.rs +++ b/src/app/config.rs @@ -28,17 +28,18 @@ pub struct Config { #[serde(rename = "contactLinks")] pub contact_links: Vec<Link>, pub pronouns: Vec<PronounSet>, + pub characters: Vec<Character>, } #[derive(Clone, Deserialize, Serialize, Default)] pub struct PronounSet { - nominative: String, - accusative: String, + pub nominative: String, + pub accusative: String, #[serde(rename = "possessiveDeterminer")] - possessive_determiner: String, - possessive: String, - reflexive: String, - singular: bool, + pub possessive_determiner: String, + pub possessive: String, + pub reflexive: String, + pub singular: bool, } impl Render for PronounSet { @@ -87,6 +88,45 @@ impl Render for PronounSet { } #[derive(Clone, Deserialize, Serialize, Default)] +pub struct Character { + pub name: String, + #[serde(rename = "stickerName")] + pub sticker_name: String, + #[serde(rename = "defaultPose")] + pub default_pose: String, + pub description: String, + pub pronouns: PronounSet, + pub stickers: Vec<String>, +} + +impl Render for Character { + fn render(&self) -> Markup { + html! { + h2 #(self.sticker_name) {(self.name)} + (xesite_templates::sticker(self.sticker_name.clone(), self.default_pose.clone())) + p {(self.description)} + details { + summary { "Pronouns (" (self.pronouns.nominative) "/" (self.pronouns.accusative) ")" } + (self.pronouns) + } + + details { + summary { "All stickers" } + .grid { + @for sticker in &self.stickers { + .cell."-3of12" { + (xesite_templates::sticker(self.sticker_name.clone(), sticker.clone())) + br; + (sticker) + } + } + } + } + } + } +} + +#[derive(Clone, Deserialize, Serialize, Default)] pub struct Link { pub url: String, pub title: String, diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 7284ec9..a638c77 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -69,6 +69,15 @@ lazy_static! { } #[instrument(skip(state))] +pub async fn characters(Extension(state): Extension<Arc<State>>) -> Markup { + HIT_COUNTER.with_label_values(&["characters"]).inc(); + let state = state.clone(); + let cfg = state.cfg.clone(); + + tmpl::characters(&cfg.characters) +} + +#[instrument(skip(state))] pub async fn index(Extension(state): Extension<Arc<State>>) -> Result<Markup> { HIT_COUNTER.with_label_values(&["index"]).inc(); let state = state.clone(); diff --git a/src/main.rs b/src/main.rs index aaf4ea4..c5b0472 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,6 +167,7 @@ async fn main() -> Result<()> { .route("/api/talks/:name", get(handlers::api::talk)) // static pages .route("/", get(handlers::index)) + .route("/characters", get(handlers::characters)) .route("/contact", get(handlers::contact)) .route("/feeds", get(handlers::feeds)) .route("/resume", get(handlers::resume)) diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs index 2ad62c0..db4f720 100644 --- a/src/tmpl/mod.rs +++ b/src/tmpl/mod.rs @@ -233,6 +233,25 @@ pub fn contact(links: &Vec<Link>) -> Markup { ) } +pub fn characters(characters: &Vec<Character>) -> Markup { + base( + Some("Characters"), + None, + html! { + h1 {"Characters"} + p{ + "When I am writing articles on this blog, sometimes I will use " + a href="https://en.wikipedia.org/wiki/Socratic_method" {"the Socratic method"} + " to help illustrate my point. These characters are written off of a set of tropes to help give them a place in the discussions. The characters are just that, characters. Their dialogues are fiction, unless otherwise indicated everything that happens in those dialogues are products of the author's imagination or are used in a fictitious manner. Any resemblance to actual persons (living or dead) is purely coincidental." + } + + @for character in characters { + (character) + } + }, + ) +} + pub fn patrons(patrons: &Users) -> Markup { base( Some("Patrons"), |
