aboutsummaryrefslogtreecommitdiff
path: root/src/tmpl
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2023-01-04 14:37:22 -0500
committerXe Iaso <me@christine.website>2023-01-04 14:37:22 -0500
commit351069d9f91edab96425bcd221858529acb7e08a (patch)
tree8d601372b5e67e6f129ff896204cdc97a49d8f3d /src/tmpl
parentb96a44649a5cdf7609ebdc975a118c01cbd74b1a (diff)
downloadxesite-351069d9f91edab96425bcd221858529acb7e08a.tar.xz
xesite-351069d9f91edab96425bcd221858529acb7e08a.zip
implement pronouns support
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src/tmpl')
-rw-r--r--src/tmpl/mod.rs24
-rw-r--r--src/tmpl/nag.rs25
2 files changed, 44 insertions, 5 deletions
diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs
index 1fbb239..2ad62c0 100644
--- a/src/tmpl/mod.rs
+++ b/src/tmpl/mod.rs
@@ -582,3 +582,27 @@ fn salary_history(jobs: &Vec<Job>) -> Markup {
}
}
}
+
+pub fn pronoun_page(pronouns: &Vec<PronounSet>) -> Markup {
+ base(
+ Some("Pronouns"),
+ None,
+ html! {
+ h1 {"Pronouns"}
+ p {"This page lists the pronouns you should use for me. Please try to use one of these sets:"}
+ .grid {
+ @for ps in pronouns {
+ .card.cell."-4of12" {
+ (ps)
+ }
+ }
+ }
+
+ (xesite_templates::conv("Mara".to_string(), "happy".to_string(), html!{
+ "You can access this data with "
+ a href="/api/pronouns" {"an API call"}
+ " too!"
+ }))
+ },
+ )
+}
diff --git a/src/tmpl/nag.rs b/src/tmpl/nag.rs
index 707c16c..7231c56 100644
--- a/src/tmpl/nag.rs
+++ b/src/tmpl/nag.rs
@@ -5,13 +5,14 @@ use regex::Regex;
lazy_static! {
static ref LOBSTERS: Regex = Regex::new(r#"^https?://lobste.rs"#).unwrap();
+ static ref HACKER_NEWS: Regex = Regex::new(r#"^https?://news.ycombinator.com"#).unwrap();
}
#[cfg(debug_assertions)]
pub fn referer(_: Option<String>) -> Markup {
html! {
.warning {
- "This is a development instance of xesite. Things here are probably unfinished or in drafting. Don't take anything here super seriously. If you want to share this to an online aggregator, please don't. Drafts are not finalized yet for a reason."
+ "This is a development instance of xesite. Things here are probably unfinished or in drafting. Don't take anything here super seriously. If you want to share this to an online aggregator, please don't. Drafts are not finalized yet for a reason. Please don't be the reason I need to implement more advanced security than just obscurity."
}
br;
}
@@ -27,12 +28,26 @@ pub fn referer(referer: Option<String>) -> Markup {
let referer = referer.unwrap();
+ if HACKER_NEWS.is_match(&referer) {
+ return xeblog_conv(
+ "Mara".into(),
+ "hacker".into(),
+ html! {
+ "Hello. Before commenting about the author, please read "
+ a href="/pronouns" {"this page"}
+ " that explains the pronouns that you should be using. tl;dr: the author of this website is NOT male. Please do not use \"he\" or \"him\" when referring to the author."
+ },
+ );
+ }
+
if LOBSTERS.is_match(&referer) {
- return html! {
- (xeblog_conv("Mara".into(), "happy".into(), html!{
+ return xeblog_conv(
+ "Mara".into(),
+ "happy".into(),
+ html! {
"Hey, thanks for reading Lobsters! We've disabled the ads to thank you for choosing to use a more ethical aggregator."
- }))
- };
+ },
+ );
}
xesite_templates::advertiser_nag()