templates/mara.rs.html: make smol smoller
Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
parent
de4256c06f
commit
0b32b1da1c
|
@ -37,7 +37,9 @@ pub fn render(inp: &str) -> Result<String> {
|
||||||
format_html(child, &options, &mut message)?;
|
format_html(child, &options, &mut message)?;
|
||||||
}
|
}
|
||||||
let message = std::str::from_utf8(&message)?;
|
let message = std::str::from_utf8(&message)?;
|
||||||
let message = markdown_to_html(message, &options);
|
let mut message = markdown_to_html(message, &options);
|
||||||
|
crop_letters(&mut message, 3);
|
||||||
|
message.drain((message.len() - 5)..);
|
||||||
let mood = without_first(u.path());
|
let mood = without_first(u.path());
|
||||||
let name = u.host_str().unwrap_or("Mara");
|
let name = u.host_str().unwrap_or("Mara");
|
||||||
|
|
||||||
|
@ -79,3 +81,14 @@ fn without_first(string: &str) -> &str {
|
||||||
.and_then(|(i, _)| string.get(i..))
|
.and_then(|(i, _)| string.get(i..))
|
||||||
.unwrap_or("")
|
.unwrap_or("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn crop_letters(s: &mut String, pos: usize) {
|
||||||
|
match s.char_indices().nth(pos) {
|
||||||
|
Some((pos, _)) => {
|
||||||
|
s.drain(..pos);
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
s.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</picture>
|
</picture>
|
||||||
</div>
|
</div>
|
||||||
@if smol {
|
@if smol {
|
||||||
<div class="conversation-chat"><b><@character></b> @message</div>
|
<div class="conversation-chat"><<b>@character</b>> @message</div>
|
||||||
} else {
|
} else {
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in New Issue