wip
This commit is contained in:
parent
70b5b6de9d
commit
062e5e105a
|
@ -22,9 +22,15 @@ where
|
||||||
's: 'r,
|
's: 'r,
|
||||||
{
|
{
|
||||||
let title = format!("{} | kamoshi.org", title);
|
let title = format!("{} | kamoshi.org", title);
|
||||||
let css = sack.get_styles("styles").expect("Missing styles");
|
let css = sack
|
||||||
let css_r = sack.get_styles("reveal").expect("Missing styles");
|
.get_styles("styles/styles.scss".into())
|
||||||
let css_p = sack.get_styles("leaflet").expect("Missing styles");
|
.expect("Missing styles");
|
||||||
|
let css_r = sack
|
||||||
|
.get_styles("styles/reveal/reveal.scss".into())
|
||||||
|
.expect("Missing styles");
|
||||||
|
let css_p = sack
|
||||||
|
.get_styles("styles/photos/leaflet.scss".into())
|
||||||
|
.expect("Missing styles");
|
||||||
|
|
||||||
let scripts = match scripts {
|
let scripts = match scripts {
|
||||||
Some(scripts) => Some(emit_tags_script(sack, scripts)?),
|
Some(scripts) => Some(emit_tags_script(sack, scripts)?),
|
||||||
|
@ -40,9 +46,9 @@ where
|
||||||
|
|
||||||
// link rel="sitemap" href="/sitemap.xml";
|
// link rel="sitemap" href="/sitemap.xml";
|
||||||
|
|
||||||
(render_style(css))
|
(render_style(&css))
|
||||||
(render_style(css_r))
|
(render_style(&css_r))
|
||||||
(render_style(css_p))
|
(render_style(&css_p))
|
||||||
|
|
||||||
link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png";
|
link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png";
|
||||||
link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png";
|
link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png";
|
||||||
|
|
|
@ -78,26 +78,18 @@ impl TreePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render the page tree
|
/// Render the page tree
|
||||||
pub(crate) fn show_page_tree<'a>(
|
pub(crate) fn show_page_tree<'a>(slug: &'a Utf8Path, sack: &'a MySack) -> impl Renderable + 'a {
|
||||||
path: &'a Utf8Path,
|
|
||||||
sack: &'a MySack,
|
|
||||||
glob: &'a str,
|
|
||||||
) -> impl Renderable + 'a {
|
|
||||||
let tree = sack
|
let tree = sack
|
||||||
.get_content_list::<Wiki>(glob)
|
.get_content_list::<Wiki>("**/*")
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|query| Link {
|
.map(|query| Link {
|
||||||
path: Utf8Path::new("/").join(query.slug),
|
path: Utf8Path::new("/").join(query.slug),
|
||||||
name: query.meta.title.clone(),
|
name: query.meta.title.clone(),
|
||||||
desc: None,
|
desc: None,
|
||||||
});
|
});
|
||||||
let tree = TreePage::from_iter(tree);
|
|
||||||
|
|
||||||
let parts = {
|
let tree = TreePage::from_iter(tree);
|
||||||
let mut parts = path.iter().skip(1).collect::<Vec<_>>();
|
let parts: Vec<_> = slug.iter().collect();
|
||||||
parts.insert(0, "wiki");
|
|
||||||
parts
|
|
||||||
};
|
|
||||||
|
|
||||||
maud_move!(
|
maud_move!(
|
||||||
h2 .link-tree__heading {
|
h2 .link-tree__heading {
|
||||||
|
@ -139,8 +131,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if key == parts[0] && !next.subs.is_empty() {
|
@if let Some(part) = parts.first() {
|
||||||
(show_page_tree_level(next, &parts[1..]))
|
@if key == part && !next.subs.is_empty() {
|
||||||
|
(show_page_tree_level(next, &parts[1..]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,18 +18,18 @@ pub fn as_html(
|
||||||
meta: &Wiki,
|
meta: &Wiki,
|
||||||
parsed: &str,
|
parsed: &str,
|
||||||
sack: &MySack,
|
sack: &MySack,
|
||||||
path: &Utf8Path,
|
slug: &Utf8Path,
|
||||||
outline: Outline,
|
outline: Outline,
|
||||||
bibliography: Bibliography,
|
bibliography: Bibliography,
|
||||||
) -> String {
|
) -> String {
|
||||||
wiki(meta, parsed, sack, path, outline, bibliography)
|
wiki(meta, parsed, sack, slug, outline, bibliography)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wiki(
|
fn wiki(
|
||||||
matter: &Wiki,
|
matter: &Wiki,
|
||||||
parsed: &str,
|
parsed: &str,
|
||||||
sack: &MySack,
|
sack: &MySack,
|
||||||
path: &Utf8Path,
|
slug: &Utf8Path,
|
||||||
_: Outline,
|
_: Outline,
|
||||||
bibliography: Bibliography,
|
bibliography: Bibliography,
|
||||||
) -> String {
|
) -> String {
|
||||||
|
@ -48,7 +48,7 @@ fn wiki(
|
||||||
// Navigation tree
|
// Navigation tree
|
||||||
section .link-tree {
|
section .link-tree {
|
||||||
div {
|
div {
|
||||||
(crate::html::misc::show_page_tree(path, sack, "wiki/**/*.html"))
|
(crate::html::misc::show_page_tree(slug, sack))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ fn main() {
|
||||||
Collection::glob_with::<Wiki>("content", "wiki/**/*", ["md"].into()),
|
Collection::glob_with::<Wiki>("content", "wiki/**/*", ["md"].into()),
|
||||||
Collection::glob_with::<Post>("content", "projects/flox.md", ["md"].into()),
|
Collection::glob_with::<Post>("content", "projects/flox.md", ["md"].into()),
|
||||||
])
|
])
|
||||||
|
.add_global_styles(["styles".into()])
|
||||||
.add_scripts(vec![
|
.add_scripts(vec![
|
||||||
("search", "./js/search/dist/search.js"),
|
("search", "./js/search/dist/search.js"),
|
||||||
("photos", "./js/vanilla/photos.js"),
|
("photos", "./js/vanilla/photos.js"),
|
||||||
|
@ -120,13 +121,13 @@ fn main() {
|
||||||
})
|
})
|
||||||
// Task: generate wiki
|
// Task: generate wiki
|
||||||
.add_task(|sack| {
|
.add_task(|sack| {
|
||||||
sack.get_content_list::<Wiki>("wiki/**/*")
|
sack.get_content_list::<Wiki>("**/*")
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|query| {
|
.map(|query| {
|
||||||
let (parsed, outline, bib) =
|
let (parsed, outline, bib) =
|
||||||
html::wiki::parse_content(query.content, &sack, query.file, None);
|
html::wiki::parse_content(query.content, &sack, query.file, None);
|
||||||
let out_buff =
|
let out_buff =
|
||||||
html::wiki::as_html(query.meta, &parsed, &sack, query.file, outline, bib);
|
html::wiki::as_html(query.meta, &parsed, &sack, query.slug, outline, bib);
|
||||||
(query.slug.join("index.html"), out_buff)
|
(query.slug.join("index.html"), out_buff)
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
Loading…
Reference in a new issue