add a link to repo in footer
This commit is contained in:
parent
dc96e49b34
commit
655fad8240
|
@ -1,6 +1,8 @@
|
||||||
use chrono::{self, Datelike};
|
use chrono::{self, Datelike};
|
||||||
use hypertext::{html_elements, maud, maud_move, GlobalAttributes, Raw, Renderable};
|
use hypertext::{html_elements, maud, maud_move, GlobalAttributes, Raw, Renderable};
|
||||||
|
|
||||||
|
use crate::REPO;
|
||||||
|
|
||||||
|
|
||||||
pub fn head(title: &str) -> impl Renderable + '_ {
|
pub fn head(title: &str) -> impl Renderable + '_ {
|
||||||
maud_move!(
|
maud_move!(
|
||||||
|
@ -83,10 +85,11 @@ pub fn footer() -> impl Renderable {
|
||||||
let copy = format!("Copyright © {} Maciej Jur", year);
|
let copy = format!("Copyright © {} Maciej Jur", year);
|
||||||
let mail = "maciej@kamoshi.org";
|
let mail = "maciej@kamoshi.org";
|
||||||
let href = format!("mailto:{}", mail);
|
let href = format!("mailto:{}", mail);
|
||||||
|
let repo = format!("{}/tree/{}", &REPO.link, &REPO.hash);
|
||||||
|
|
||||||
maud_move!(
|
maud_move!(
|
||||||
footer .footer {
|
footer .footer {
|
||||||
div {
|
div .left {
|
||||||
div {
|
div {
|
||||||
(Raw(copy))
|
(Raw(copy))
|
||||||
}
|
}
|
||||||
|
@ -94,7 +97,10 @@ pub fn footer() -> impl Renderable {
|
||||||
(mail)
|
(mail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a .footer__cc-wrap rel="license" href="http://creativecommons.org/licenses/by/4.0/" {
|
a href=(repo) {
|
||||||
|
"view source"
|
||||||
|
}
|
||||||
|
a .right.footer__cc-wrap rel="license" href="http://creativecommons.org/licenses/by/4.0/" {
|
||||||
img .footer__cc-stamp alt="Creative Commons License" width="88" height="31" src="/static/svg/by.svg";
|
img .footer__cc-stamp alt="Creative Commons License" width="88" height="31" src="/static/svg/by.svg";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
src/main.rs
33
src/main.rs
|
@ -1,9 +1,11 @@
|
||||||
|
use std::process::Command;
|
||||||
use std::{collections::HashMap, path::Path};
|
use std::{collections::HashMap, path::Path};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use chrono::Datelike;
|
use chrono::Datelike;
|
||||||
use grass;
|
use grass;
|
||||||
use html::LinkableData;
|
use html::LinkableData;
|
||||||
use hypertext::{Raw, Renderable};
|
use hypertext::{Raw, Renderable};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
mod md;
|
mod md;
|
||||||
mod html;
|
mod html;
|
||||||
|
@ -12,6 +14,28 @@ mod gen;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct RepoInfo {
|
||||||
|
pub link: String,
|
||||||
|
pub hash: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static REPO: Lazy<RepoInfo> = Lazy::new(|| RepoInfo {
|
||||||
|
link: "https://github.com/kamoshi/kamoshi.org".into(),
|
||||||
|
hash: String::from_utf8(
|
||||||
|
Command::new("git")
|
||||||
|
.args(["rev-parse", "HEAD"])
|
||||||
|
.output()
|
||||||
|
.unwrap()
|
||||||
|
.stdout
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.trim()
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
trait Transformable {
|
trait Transformable {
|
||||||
fn transform<'f, 'm, 'html, T>(&'f self, content: T) -> impl Renderable + 'html
|
fn transform<'f, 'm, 'html, T>(&'f self, content: T) -> impl Renderable + 'html
|
||||||
where
|
where
|
||||||
|
@ -193,12 +217,7 @@ fn transform<T>(meta: gen::Source) -> gen::Asset
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let xd = Command::new("git")
|
println!("{:?}", &*REPO);
|
||||||
.args(["rev-parse", "HEAD"])
|
|
||||||
.output()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
println!("{:?}", String::from_utf8(xd.stdout).unwrap());
|
|
||||||
|
|
||||||
if fs::metadata("dist").is_ok() {
|
if fs::metadata("dist").is_ok() {
|
||||||
println!("Cleaning dist");
|
println!("Cleaning dist");
|
||||||
|
@ -281,8 +300,6 @@ fn main() {
|
||||||
let css = grass::from_path("styles/styles.scss", &grass::Options::default()).unwrap();
|
let css = grass::from_path("styles/styles.scss", &grass::Options::default()).unwrap();
|
||||||
fs::write("dist/styles.css", css).unwrap();
|
fs::write("dist/styles.css", css).unwrap();
|
||||||
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
let res = Command::new("pagefind")
|
let res = Command::new("pagefind")
|
||||||
.args(&["--site", "dist"])
|
.args(&["--site", "dist"])
|
||||||
.output()
|
.output()
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
.footer {
|
.footer {
|
||||||
display: flex;
|
display: grid;
|
||||||
align-items: center;
|
grid-template-columns: 1fr auto 1fr;
|
||||||
justify-content: space-between;
|
grid-column-gap: 0.25em;
|
||||||
|
justify-items: center;
|
||||||
|
|
||||||
max-height: min-content;
|
max-height: min-content;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
font-size: var(--fs-sm);
|
font-size: var(--fs-sm);
|
||||||
|
@ -12,6 +14,14 @@
|
||||||
color: var(--c-primary);
|
color: var(--c-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
&__cc-wrap {
|
&__cc-wrap {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue