Run cargo fmt

This commit is contained in:
Kitaiti Makoto 2020-12-28 22:15:45 +09:00
parent 8b16b9aaa4
commit c482b1b552
1 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
use heck::CamelCase; use heck::CamelCase;
use openssl::rand::rand_bytes; use openssl::rand::rand_bytes;
use pulldown_cmark::{html, LinkType, Event, Options, Parser, Tag, CodeBlockKind, CowStr}; use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, LinkType, Options, Parser, Tag};
use regex_syntax::is_word_character; use regex_syntax::is_word_character;
use rocket::{ use rocket::{
http::uri::Uri, http::uri::Uri,
@ -69,7 +69,7 @@ fn highlight_code<'a>(
match &kind { match &kind {
CodeBlockKind::Fenced(lang) if !lang.is_empty() => { CodeBlockKind::Fenced(lang) if !lang.is_empty() => {
*context = Some(HighlighterContext { content: vec![] }); *context = Some(HighlighterContext { content: vec![] });
}, }
_ => {} _ => {}
} }
Some(vec![Event::Start(Tag::CodeBlock(kind))]) Some(vec![Event::Start(Tag::CodeBlock(kind))])
@ -169,18 +169,21 @@ fn process_image<'a, 'b>(
if let Some((url, cw)) = id.parse::<i32>().ok().and_then(processor.as_ref()) { if let Some((url, cw)) = id.parse::<i32>().ok().and_then(processor.as_ref()) {
if let (Some(cw), false) = (cw, inline) { if let (Some(cw), false) = (cw, inline) {
// there is a cw, and where are not inline // there is a cw, and where are not inline
Event::Html(CowStr::Boxed(format!( Event::Html(CowStr::Boxed(
r#"<label for="postcontent-cw-{id}"> format!(
r#"<label for="postcontent-cw-{id}">
<input type="checkbox" id="postcontent-cw-{id}" checked="checked" class="cw-checkbox"> <input type="checkbox" id="postcontent-cw-{id}" checked="checked" class="cw-checkbox">
<span class="cw-container"> <span class="cw-container">
<span class="cw-text"> <span class="cw-text">
{cw} {cw}
</span> </span>
<img src="{url}" alt=""#, <img src="{url}" alt=""#,
id = random_hex(), id = random_hex(),
cw = cw, cw = cw,
url = url url = url
).into())) )
.into(),
))
} else { } else {
Event::Start(Tag::Image(typ, CowStr::Boxed(url.into()), title)) Event::Start(Tag::Image(typ, CowStr::Boxed(url.into()), title))
} }