diff --git a/majc/src/gemini.rs b/majc/src/gemini.rs index c0853d1..58065c1 100644 --- a/majc/src/gemini.rs +++ b/majc/src/gemini.rs @@ -224,7 +224,7 @@ pub fn render(body: &str) -> StyledString { styled.append(StyledString::styled(name, Style::from(Effect::Underline))) } }, - Preformatted(data) => styled.append(StyledString::plain(data)), + Preformatted { body, .. } => styled.append(StyledString::plain(body)), Heading { level, body } => styled.append(StyledString::styled( format!("{} {}", "#".repeat(level as usize), body), Style::from(Effect::Bold), diff --git a/pilno/karnycukta/src/zbasu/mod.rs b/pilno/karnycukta/src/zbasu/mod.rs index e2f2679..3a32c24 100644 --- a/pilno/karnycukta/src/zbasu/mod.rs +++ b/pilno/karnycukta/src/zbasu/mod.rs @@ -25,7 +25,7 @@ fn gem_to_md(tcana: Vec, out: &mut impl Write) -> io::Result<()> { Some(name) => write!(out, "[{}]({})\n\n", name, to)?, None => write!(out, "[{0}]({0})", to)?, }, - Preformatted(body) => write!(out, "```\n{}\n```\n\n", body)?, + Preformatted { alt, body } => write!(out, "```{}\n{}\n```\n\n", alt, body)?, Heading { level, body } => { write!(out, "##{} {}\n\n", "#".repeat(level as usize), body)? } diff --git a/site/src/http.rs b/site/src/http.rs index fee6a9a..29066f9 100644 --- a/site/src/http.rs +++ b/site/src/http.rs @@ -80,7 +80,12 @@ fn gemtext_to_html(inp: Vec) -> (String, impl ToHtml) { name.as_ref().or(Some(&to.to_string())).unwrap() ) .unwrap(), - Preformatted(body) => write!(buf, "
{}
", body).unwrap(), + Preformatted { alt, body } => write!( + buf, + "
{}
", + alt.replace("\"", "\\\"").replace("\\", "\\\\"), + body + ).unwrap(), ListItem(body) => write!(buf, "
  • {}
  • ", body).unwrap(), Quote(body) => write!(buf, "
    {}
    ", body).unwrap(), } diff --git a/site/src/server.rs b/site/src/server.rs index 64ad802..deb1644 100644 --- a/site/src/server.rs +++ b/site/src/server.rs @@ -56,7 +56,7 @@ async fn dice(req: Request) -> Result { .text("") .text(format!("You rolled {} and you got:", dice)) .text("") - .preformatted(format!("{}", dice_roll(dice)?)) + .preformatted("", format!("{}", dice_roll(dice)?)) .text("") .link("/dice", Some("Do another roll".to_string()));