Update some dependencies
parent
f793227b82
commit
64d09e0061
10
Cargo.toml
10
Cargo.toml
|
@ -1,16 +1,16 @@
|
|||
[package]
|
||||
name = "codigocomentado"
|
||||
version = "0.1.0"
|
||||
authors = ["kirbylife <gabriel13m@gmail.com>"]
|
||||
authors = ["kirbylife <kirbylife@protonmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rocket = { version = "0.5.0", features = ["secrets"] }
|
||||
rocket_dyn_templates = { version = "0.1.0", features = ["tera"] }
|
||||
diesel = { version = "1.0.0", features = ["postgres", "chrono"] }
|
||||
dotenv = "0.9.0"
|
||||
rand = "0.6.0"
|
||||
dotenv = "0.15.0"
|
||||
rand = "0.8.5"
|
||||
chrono = { version = "0.4.9", features = ["serde"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
comrak = "0.6"
|
||||
tera = "1.19.1"
|
||||
comrak = "0.24.1"
|
||||
tera = "1.19.1"
|
38
src/main.rs
38
src/main.rs
|
@ -10,7 +10,7 @@ extern crate rocket;
|
|||
#[macro_use]
|
||||
extern crate diesel;
|
||||
|
||||
use comrak::{markdown_to_html, ComrakOptions};
|
||||
use comrak::{markdown_to_html, Options};
|
||||
use controllers::posts;
|
||||
use dotenv::dotenv;
|
||||
use rocket::fs::{FileServer, NamedFile};
|
||||
|
@ -35,13 +35,11 @@ fn index(page: Option<u64>) -> Template {
|
|||
fn rss_feed() -> RawXml<Template> {
|
||||
let (mut posts, _) = posts::get_posts(None);
|
||||
|
||||
let comrak_options = ComrakOptions {
|
||||
ext_table: true,
|
||||
ext_autolink: true,
|
||||
ext_tasklist: true,
|
||||
unsafe_: true,
|
||||
..ComrakOptions::default()
|
||||
};
|
||||
let mut comrak_options = Options::default();
|
||||
comrak_options.extension.table = true;
|
||||
comrak_options.extension.autolink = true;
|
||||
comrak_options.extension.tasklist = true;
|
||||
comrak_options.render.unsafe_ = true;
|
||||
|
||||
posts.iter_mut().for_each(|post| {
|
||||
let content = markdown_to_html(&post.content, &comrak_options);
|
||||
|
@ -57,13 +55,11 @@ fn rss_feed() -> RawXml<Template> {
|
|||
fn atom_feed() -> RawXml<Template> {
|
||||
let (mut posts, _) = posts::get_posts(None);
|
||||
|
||||
let comrak_options = ComrakOptions {
|
||||
ext_table: true,
|
||||
ext_autolink: true,
|
||||
ext_tasklist: true,
|
||||
unsafe_: true,
|
||||
..ComrakOptions::default()
|
||||
};
|
||||
let mut comrak_options = Options::default();
|
||||
comrak_options.extension.table = true;
|
||||
comrak_options.extension.autolink = true;
|
||||
comrak_options.extension.tasklist = true;
|
||||
comrak_options.render.unsafe_ = true;
|
||||
|
||||
posts.iter_mut().for_each(|post| {
|
||||
let content = markdown_to_html(&post.content, &comrak_options);
|
||||
|
@ -82,13 +78,11 @@ fn show_post(title: String) -> Template {
|
|||
|
||||
match posts::get_post(id) {
|
||||
Ok(mut post) => {
|
||||
let comrak_options = ComrakOptions {
|
||||
ext_table: true,
|
||||
ext_autolink: true,
|
||||
ext_tasklist: true,
|
||||
unsafe_: true,
|
||||
..ComrakOptions::default()
|
||||
};
|
||||
let mut comrak_options = Options::default();
|
||||
comrak_options.extension.table = true;
|
||||
comrak_options.extension.autolink = true;
|
||||
comrak_options.extension.tasklist = true;
|
||||
comrak_options.render.unsafe_ = true;
|
||||
|
||||
let content = markdown_to_html(&post.content, &comrak_options);
|
||||
post.content = content;
|
||||
|
|
|
@ -16,7 +16,7 @@ const TITLES: [&str; 11] = [
|
|||
|
||||
pub fn gen_title() -> String {
|
||||
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");
|
||||
title.to_string()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue