From 36705e7c1e7b858feb2a5d6581b222edac087d7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=83=AA=E3=82=AD=E8=90=8C?= write!(out, " and in the link text,
- // but preserve other formatting such as bold, italic, code, etc.
- jotdown::Event::Start(
- jotdown::Container::Link(_, _) | jotdown::Container::Heading { .. },
- _
- ) | jotdown::Event::End(
- jotdown::Container::Link(_, _) | jotdown::Container::Heading { .. }
- )
- )
- })
- .cloned()
- .collect();
- let mut title = String::new();
- let _render_diagnostics = djot::Renderer {
- config: &sources.config,
- dirs,
- treehouse: &sources.treehouse,
- file_id,
-
- // How. Just, stop.
- page_id: "liquidex-you-reeeeeal-dummy".into(),
- }
- .render(&title_events, &mut title);
-
- let link = events.iter().find_map(|(event, _)| {
- if let jotdown::Event::Start(jotdown::Container::Link(link, link_type), _) = event {
- Some(link_url(sources, dirs, link, *link_type))
- } else {
- None
- }
- });
-
- return ParsedEntry {
- title: (!title.is_empty()).then_some(title),
- link,
- };
- }
- }
-
- ParsedEntry {
- title: None,
- link: None,
- }
-}
-
-fn link_url(sources: &Sources, dirs: &Dirs, url: &str, link_type: jotdown::LinkType) -> String {
- if let jotdown::LinkType::Span(jotdown::SpanLinkType::Unresolved) = link_type {
- if let Some(url) = resolve_link(&sources.config, &sources.treehouse, dirs, url) {
- return url;
- }
- }
- url.to_owned()
-}
-
/// Extremely simple HTML renderer without the treehouse's fancy branch folding and linking features.
fn branches_to_html_simple(
s: &mut String,
diff --git a/src/generate/doc.rs b/src/generate/doc.rs
new file mode 100644
index 0000000..eda596f
--- /dev/null
+++ b/src/generate/doc.rs
@@ -0,0 +1,242 @@
+use std::{
+ fmt::{self},
+ sync::Arc,
+};
+
+use anyhow::Context;
+use chrono::{DateTime, Utc};
+use handlebars::Handlebars;
+use serde::{Deserialize, Serialize};
+use tracing::{error, instrument};
+
+use crate::{
+ dirs::Dirs,
+ generate::BaseTemplateData,
+ html::djot,
+ sources::Sources,
+ state::{report_diagnostics, toml_error_to_diagnostic, FileId, TomlError},
+ tree::{attributes::Picture, feed},
+ vfs::{Content, Dir, Query, VPath},
+};
+
+#[derive(Default, Deserialize)]
+struct Attributes {
+ /// Template to use for generating the page.
+ /// Defaults to `_tree.hbs`.
+ #[serde(default)]
+ template: Option
1 {
- write!(out, r#" start="{}""#, start)?;
+ write!(out, r#" start="{start}""#)?;
}
if let Some(ty) = match numbering {
Decimal => None,
@@ -172,7 +157,7 @@ impl<'a> Writer<'a> {
RomanLower => Some('i'),
RomanUpper => Some('I'),
} {
- write!(out, r#" type="{}""#, ty)?;
+ write!(out, r#" type="{ty}""#)?;
}
}
}
@@ -182,7 +167,7 @@ impl<'a> Writer<'a> {
}
Container::DescriptionList => out.push_str("
out.push_str("
out.push_str("
"),
Container::TableRow { .. } => out.push_str(""),
Container::Section { .. } => {}
@@ -455,7 +440,7 @@ impl<'a> Writer<'a> {
}
out.push_str(" {}
@@ -193,7 +178,7 @@ impl<'a> Writer<'a> {
}
out.push_str(" out.push_str(" out.push_str("
F4$N-j8o
zI&>~;v8?-L`2M?u(w0wm<_J2yPR#UYV|c&>sh}7dX7? HCvn@5zx2kBlo>B}$Vx7#IXPId#4o^e**R+sLr;t5M<8e*4((&qdY+
zSjul;eKDhg)j|c7M{|xXzr=7zV8fS{-#c7SFlBz(7J6YTBli+B<4Hmr7)nk#XFZsF
zw(9j00fq$v^BY=>a^yqQqdC8xo#wQB>j#H>*Bqx@i{7!xIPJH>b(tq7pPi-V+wR|z
zE8tM0ww__J9}gpg$LTMk4e8s2Ud`5RZCF{w8_qU;*?Nxfj5FVkwdXMI0<8;VVA%Eb
z_jk3LD?UdqZI4r)_I|(R-|s%AjhCzV!WX!4vj#JXHS~3aHw1%1>%^Haq79E(bZTE~
zCfxiR+1`-)opp}6i}slVAb~Z-)`=24{Fj@y~4z>z!cKT
z4N2IOU2Xb?Pm9qZKTA${$!ji#116Bn%fR5e%5n!2!+{bAKg8j>C__=z_kWr%uWOrb
zNdn~&8Hf}EgXiBbkDu0G&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