import instead of qualify
This commit is contained in:
parent
530975efff
commit
4b5fa8561c
7 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
use actix_files::Files;
|
||||
use actix_web::{middleware::DefaultHeaders, web, App, HttpServer};
|
||||
use std::io::Result;
|
||||
|
||||
mod config;
|
||||
mod template;
|
||||
|
@ -27,7 +28,7 @@ mod portfolio;
|
|||
mod contrib;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
async fn main() -> Result<()> {
|
||||
let config = config::get_config("./config/config.toml");
|
||||
|
||||
let addr = ("0.0.0.0", config.fc.port.unwrap());
|
||||
|
|
|
@ -40,7 +40,7 @@ struct Pull {
|
|||
}
|
||||
|
||||
#[once(time = 120)]
|
||||
pub async fn get_page(config: Config) -> std::string::String {
|
||||
pub async fn get_page(config: Config) -> String {
|
||||
// Fetch latest data from github
|
||||
let data = match fetch_pr().await {
|
||||
Ok(projects) => {
|
||||
|
|
|
@ -13,7 +13,7 @@ pub async fn page(config: web::Data<Config>) -> impl Responder {
|
|||
struct IndexTemplate {}
|
||||
|
||||
#[once(time = 60)]
|
||||
pub fn get_page(config: Config) -> std::string::String {
|
||||
pub fn get_page(config: Config) -> String {
|
||||
config.tmpl.render(
|
||||
"index.html",
|
||||
IndexTemplate {},
|
||||
|
|
|
@ -13,7 +13,7 @@ pub async fn page(config: web::Data<Config>) -> impl Responder {
|
|||
struct NetworksTemplate {}
|
||||
|
||||
#[once(time = 60)]
|
||||
pub fn get_page(config: Config) -> std::string::String {
|
||||
pub fn get_page(config: Config) -> String {
|
||||
config.tmpl.render(
|
||||
"networks.html",
|
||||
NetworksTemplate {},
|
||||
|
|
|
@ -12,7 +12,7 @@ pub async fn page(config: web::Data<Config>) -> impl Responder {
|
|||
struct Error404Template {}
|
||||
|
||||
#[once(time = 60)]
|
||||
pub fn get_page(config: Config) -> std::string::String {
|
||||
pub fn get_page(config: Config) -> String {
|
||||
config
|
||||
.tmpl
|
||||
.render("404.html", Error404Template {}, Infos::default())
|
||||
|
|
|
@ -21,7 +21,7 @@ struct PortfolioTemplate {
|
|||
}
|
||||
|
||||
#[once(time = 60)]
|
||||
pub fn get_page(config: Config) -> std::string::String {
|
||||
pub fn get_page(config: Config) -> String {
|
||||
let projects_dir = "data/projects";
|
||||
let ext = ".md";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use ramhorns::{Content, Ramhorns};
|
||||
use serde::Deserialize;
|
||||
use std::fs;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Template {
|
||||
|
@ -72,7 +73,7 @@ pub struct File {
|
|||
|
||||
pub fn read_md(filename: &str) -> File {
|
||||
// Read markdown file
|
||||
let mut text = std::fs::read_to_string(filename).unwrap();
|
||||
let mut text = fs::read_to_string(filename).unwrap();
|
||||
|
||||
// Transform LaTeX to MathML
|
||||
text = latex2mathml::replace(&text).unwrap();
|
||||
|
|
Loading…
Reference in a new issue