Update some dependencies

master
kirbylife 2024-05-31 00:54:09 -06:00
parent f793227b82
commit 64d09e0061
3 changed files with 22 additions and 28 deletions

View File

@ -1,16 +1,16 @@
[package] [package]
name = "codigocomentado" name = "codigocomentado"
version = "0.1.0" version = "0.1.0"
authors = ["kirbylife <gabriel13m@gmail.com>"] authors = ["kirbylife <kirbylife@protonmail.com>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
rocket = { version = "0.5.0", features = ["secrets"] } rocket = { version = "0.5.0", features = ["secrets"] }
rocket_dyn_templates = { version = "0.1.0", features = ["tera"] } rocket_dyn_templates = { version = "0.1.0", features = ["tera"] }
diesel = { version = "1.0.0", features = ["postgres", "chrono"] } diesel = { version = "1.0.0", features = ["postgres", "chrono"] }
dotenv = "0.9.0" dotenv = "0.15.0"
rand = "0.6.0" rand = "0.8.5"
chrono = { version = "0.4.9", features = ["serde"] } chrono = { version = "0.4.9", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
comrak = "0.6" comrak = "0.24.1"
tera = "1.19.1" tera = "1.19.1"

View File

@ -10,7 +10,7 @@ extern crate rocket;
#[macro_use] #[macro_use]
extern crate diesel; extern crate diesel;
use comrak::{markdown_to_html, ComrakOptions}; use comrak::{markdown_to_html, Options};
use controllers::posts; use controllers::posts;
use dotenv::dotenv; use dotenv::dotenv;
use rocket::fs::{FileServer, NamedFile}; use rocket::fs::{FileServer, NamedFile};
@ -35,13 +35,11 @@ fn index(page: Option<u64>) -> Template {
fn rss_feed() -> RawXml<Template> { fn rss_feed() -> RawXml<Template> {
let (mut posts, _) = posts::get_posts(None); let (mut posts, _) = posts::get_posts(None);
let comrak_options = ComrakOptions { let mut comrak_options = Options::default();
ext_table: true, comrak_options.extension.table = true;
ext_autolink: true, comrak_options.extension.autolink = true;
ext_tasklist: true, comrak_options.extension.tasklist = true;
unsafe_: true, comrak_options.render.unsafe_ = true;
..ComrakOptions::default()
};
posts.iter_mut().for_each(|post| { posts.iter_mut().for_each(|post| {
let content = markdown_to_html(&post.content, &comrak_options); let content = markdown_to_html(&post.content, &comrak_options);
@ -57,13 +55,11 @@ fn rss_feed() -> RawXml<Template> {
fn atom_feed() -> RawXml<Template> { fn atom_feed() -> RawXml<Template> {
let (mut posts, _) = posts::get_posts(None); let (mut posts, _) = posts::get_posts(None);
let comrak_options = ComrakOptions { let mut comrak_options = Options::default();
ext_table: true, comrak_options.extension.table = true;
ext_autolink: true, comrak_options.extension.autolink = true;
ext_tasklist: true, comrak_options.extension.tasklist = true;
unsafe_: true, comrak_options.render.unsafe_ = true;
..ComrakOptions::default()
};
posts.iter_mut().for_each(|post| { posts.iter_mut().for_each(|post| {
let content = markdown_to_html(&post.content, &comrak_options); let content = markdown_to_html(&post.content, &comrak_options);
@ -82,13 +78,11 @@ fn show_post(title: String) -> Template {
match posts::get_post(id) { match posts::get_post(id) {
Ok(mut post) => { Ok(mut post) => {
let comrak_options = ComrakOptions { let mut comrak_options = Options::default();
ext_table: true, comrak_options.extension.table = true;
ext_autolink: true, comrak_options.extension.autolink = true;
ext_tasklist: true, comrak_options.extension.tasklist = true;
unsafe_: true, comrak_options.render.unsafe_ = true;
..ComrakOptions::default()
};
let content = markdown_to_html(&post.content, &comrak_options); let content = markdown_to_html(&post.content, &comrak_options);
post.content = content; post.content = content;

View File

@ -16,7 +16,7 @@ const TITLES: [&str; 11] = [
pub fn gen_title() -> String { pub fn gen_title() -> String {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let title_fmt = TITLES[rng.gen_range(0, TITLES.len())]; let title_fmt = TITLES[rng.gen_range(0..TITLES.len())];
let title = str::replace(title_fmt, "{}", "CódigoComentado"); let title = str::replace(title_fmt, "{}", "CódigoComentado");
title.to_string() title.to_string()
} }