cargo clippy --fix && cargo fmt
This commit is contained in:
parent
78eea37b94
commit
69680f227c
2 changed files with 6 additions and 7 deletions
|
@ -19,8 +19,7 @@ pub fn render_markdown_to_html(markdown: &str) -> Result<String> {
|
||||||
Event::Text(text) => {
|
Event::Text(text) => {
|
||||||
if code_block {
|
if code_block {
|
||||||
code_accumulator.push_str(&text);
|
code_accumulator.push_str(&text);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
events.push(Event::Text(text));
|
events.push(Event::Text(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/post.rs
10
src/post.rs
|
@ -4,14 +4,14 @@ use chrono::{DateTime, FixedOffset};
|
||||||
use glob::glob;
|
use glob::glob;
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use pulldown_cmark::{html, Options, Parser};
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
use tracing::{instrument, log::*};
|
use tracing::{instrument, log::*};
|
||||||
|
|
||||||
use crate::{AppState, WebsiteError, markdown};
|
use crate::{markdown, AppState, WebsiteError};
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Default)]
|
#[derive(Deserialize, Debug, Default)]
|
||||||
pub struct TomlFrontMatter {
|
pub struct TomlFrontMatter {
|
||||||
|
@ -102,9 +102,9 @@ pub async fn load_post(slug: &str) -> color_eyre::eyre::Result<Post> {
|
||||||
let (tomlfm, content) = parse_frontmatter(content)?;
|
let (tomlfm, content) = parse_frontmatter(content)?;
|
||||||
let tomlfm = tomlfm.expect("Missing frontmatter");
|
let tomlfm = tomlfm.expect("Missing frontmatter");
|
||||||
|
|
||||||
let content = content.map(|c| {
|
let content = content
|
||||||
markdown::render_markdown_to_html(&c)
|
.map(|c| markdown::render_markdown_to_html(&c))
|
||||||
}).transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
Ok(Post::new(
|
Ok(Post::new(
|
||||||
slug.to_string(),
|
slug.to_string(),
|
||||||
|
|
Loading…
Reference in a new issue