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