diff options
| author | Christine Dodrill <me@christine.website> | 2021-04-02 22:28:18 -0400 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2021-04-02 22:28:18 -0400 |
| commit | 0b32b1da1cbb5ad557bfd860ef581e71b302eb7e (patch) | |
| tree | a2e92ef615ac1233e0b6fb595b2776a6af677c2a | |
| parent | de4256c06f7906f9ad84721726c2797b657e2b8b (diff) | |
| download | xesite-0b32b1da1cbb5ad557bfd860ef581e71b302eb7e.tar.xz xesite-0b32b1da1cbb5ad557bfd860ef581e71b302eb7e.zip | |
templates/mara.rs.html: make smol smoller
Signed-off-by: Christine Dodrill <me@christine.website>
| -rw-r--r-- | src/app/markdown.rs | 15 | ||||
| -rw-r--r-- | templates/mara.rs.html | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/app/markdown.rs b/src/app/markdown.rs index 1410776..0b5f096 100644 --- a/src/app/markdown.rs +++ b/src/app/markdown.rs @@ -37,7 +37,9 @@ pub fn render(inp: &str) -> Result<String> { format_html(child, &options, &mut 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 name = u.host_str().unwrap_or("Mara"); @@ -79,3 +81,14 @@ fn without_first(string: &str) -> &str { .and_then(|(i, _)| string.get(i..)) .unwrap_or("") } + +fn crop_letters(s: &mut String, pos: usize) { + match s.char_indices().nth(pos) { + Some((pos, _)) => { + s.drain(..pos); + } + None => { + s.clear(); + } + } +} diff --git a/templates/mara.rs.html b/templates/mara.rs.html index 06d977e..f892c1e 100644 --- a/templates/mara.rs.html +++ b/templates/mara.rs.html @@ -8,7 +8,7 @@ </picture> </div> @if smol { - <div class="conversation-chat"><b><@character></b> @message</div> + <div class="conversation-chat"><<b>@character</b>> @message</div> } else { <div> <p> |
