aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2021-04-01 22:30:45 -0400
committerGitHub <noreply@github.com>2021-04-01 22:30:45 -0400
commit8383914aa5abc232fa56ce437e777d5024eb63e1 (patch)
treebedceacc5a8e1260e73d251a84d44838a3e25acb /src/app
parent0360c87582e2e5025c06fec2431b867992dc71b0 (diff)
downloadxesite-8383914aa5abc232fa56ce437e777d5024eb63e1.tar.xz
xesite-8383914aa5abc232fa56ce437e777d5024eb63e1.zip
Unix domain socket http server (#352)
* enable ipv6 support Signed-off-by: Christine Dodrill <me@christine.website> * enable unix socket powers Signed-off-by: Christine Dodrill <me@christine.website> * unix domain socket post Signed-off-by: Christine Dodrill <me@christine.website> * bump rust Signed-off-by: Christine Dodrill <me@christine.website>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/markdown.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/app/markdown.rs b/src/app/markdown.rs
index fe33a21..1410776 100644
--- a/src/app/markdown.rs
+++ b/src/app/markdown.rs
@@ -1,8 +1,8 @@
+use crate::templates::Html;
use color_eyre::eyre::{Result, WrapErr};
use comrak::nodes::{Ast, AstNode, NodeValue};
-use comrak::{format_html, parse_document, markdown_to_html, Arena, ComrakOptions};
+use comrak::{format_html, markdown_to_html, parse_document, Arena, ComrakOptions};
use std::cell::RefCell;
-use crate::templates::Html;
use url::Url;
pub fn render(inp: &str) -> Result<String> {
@@ -29,6 +29,7 @@ pub fn render(inp: &str) -> Result<String> {
if u.scheme() != "conversation" {
return Ok(());
}
+ let smol = u.query().unwrap_or("").contains("smol");
let parent = node.parent().unwrap();
node.detach();
let mut message = vec![];
@@ -41,10 +42,11 @@ pub fn render(inp: &str) -> Result<String> {
let name = u.host_str().unwrap_or("Mara");
let mut html = vec![];
- crate::templates::mara(&mut html, mood, name, Html(message))?;
+ crate::templates::mara(&mut html, mood, name, Html(message.trim().into()), smol)?;
- let new_node =
- arena.alloc(AstNode::new(RefCell::new(Ast::new(NodeValue::HtmlInline(html)))));
+ let new_node = arena.alloc(AstNode::new(RefCell::new(Ast::new(
+ NodeValue::HtmlInline(html),
+ ))));
parent.append(new_node);
Ok(())