Compare commits
6 Commits
0420f58d02
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3929f22f3 | ||
|
|
bad12160ac | ||
|
|
c43679fda9 | ||
|
|
9cc28f6f0d | ||
|
|
d2256b8333 | ||
|
|
fa8753077a |
@@ -203,7 +203,7 @@ spec:
|
|||||||
- name: git-source
|
- name: git-source
|
||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
spec:
|
spec:
|
||||||
storageClassName: "nfs-client"
|
storageClassName: "local-path"
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ spec:
|
|||||||
- name: git-source
|
- name: git-source
|
||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
spec:
|
spec:
|
||||||
storageClassName: "nfs-client"
|
storageClassName: "local-path"
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ spec:
|
|||||||
- name: git-source
|
- name: git-source
|
||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
spec:
|
spec:
|
||||||
storageClassName: "nfs-client"
|
storageClassName: "local-path"
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ spec:
|
|||||||
- name: git-source
|
- name: git-source
|
||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
spec:
|
spec:
|
||||||
storageClassName: "nfs-client"
|
storageClassName: "local-path"
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "natter"
|
name = "natter"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
authors = ["Tom Alexander <tom@fizz.buzz>"]
|
authors = ["Tom Alexander <tom@fizz.buzz>"]
|
||||||
description = "A static site generator using org source files."
|
description = "A static site generator using org source files."
|
||||||
license = "0BSD"
|
license = "0BSD"
|
||||||
|
|||||||
5
TODO.org
5
TODO.org
@@ -1,4 +1,4 @@
|
|||||||
* Things to do [5/14]
|
* Things to do [6/17]
|
||||||
** DONE If the paragraph only contains an image, text-align center
|
** DONE If the paragraph only contains an image, text-align center
|
||||||
** DONE Syntax highlighting for code blocks
|
** DONE Syntax highlighting for code blocks
|
||||||
** TODO Render gnuplot
|
** TODO Render gnuplot
|
||||||
@@ -16,3 +16,6 @@
|
|||||||
*** TODO gnuplot
|
*** TODO gnuplot
|
||||||
https://github.com/dpezto/tree-sitter-gnuplot is not on crates.io so I'd have to add a git dependency to use it. This would prevent publishing this crate to crates.io.
|
https://github.com/dpezto/tree-sitter-gnuplot is not on crates.io so I'd have to add a git dependency to use it. This would prevent publishing this crate to crates.io.
|
||||||
** DONE Bug: carry over highlight starts when breaking lines
|
** DONE Bug: carry over highlight starts when breaking lines
|
||||||
|
** TODO Add dates to posts
|
||||||
|
** DONE Add support for unlisted posts (posts that do not show up on the homepage).
|
||||||
|
** TODO Add support for showing file name where we currently show language
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use include_dir::include_dir;
|
|
||||||
use include_dir::Dir;
|
use include_dir::Dir;
|
||||||
|
use include_dir::include_dir;
|
||||||
use tokio::fs::DirEntry;
|
use tokio::fs::DirEntry;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
@@ -15,14 +15,15 @@ use crate::context::RenderBlogStreamInput;
|
|||||||
use crate::context::RenderContext;
|
use crate::context::RenderContext;
|
||||||
use crate::context::RenderPage;
|
use crate::context::RenderPage;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::get_web_path;
|
|
||||||
use crate::intermediate::BlogPost;
|
use crate::intermediate::BlogPost;
|
||||||
use crate::intermediate::IPage;
|
use crate::intermediate::IPage;
|
||||||
|
use crate::intermediate::PublishStatus;
|
||||||
|
use crate::intermediate::get_web_path;
|
||||||
use crate::render::DusterRenderer;
|
use crate::render::DusterRenderer;
|
||||||
use crate::render::RendererIntegration;
|
use crate::render::RendererIntegration;
|
||||||
use crate::walk_fs::walk_fs;
|
|
||||||
use crate::walk_fs::WalkAction;
|
use crate::walk_fs::WalkAction;
|
||||||
use crate::walk_fs::WalkFsFilterResult;
|
use crate::walk_fs::WalkFsFilterResult;
|
||||||
|
use crate::walk_fs::walk_fs;
|
||||||
|
|
||||||
use super::stylesheet::Stylesheet;
|
use super::stylesheet::Stylesheet;
|
||||||
|
|
||||||
@@ -84,7 +85,11 @@ impl SiteRenderer {
|
|||||||
pub(crate) async fn render_pages(&self, config: &Config) -> Result<(), CustomError> {
|
pub(crate) async fn render_pages(&self, config: &Config) -> Result<(), CustomError> {
|
||||||
let renderer_integration = self.init_renderer_integration()?;
|
let renderer_integration = self.init_renderer_integration()?;
|
||||||
|
|
||||||
for page in &self.pages {
|
for page in self.pages.iter().filter(|page| match page.natter_publish {
|
||||||
|
PublishStatus::Full => true,
|
||||||
|
PublishStatus::Unlisted => true,
|
||||||
|
PublishStatus::Unpublished => false,
|
||||||
|
}) {
|
||||||
let output_path = self.output_directory.join(page.get_output_path());
|
let output_path = self.output_directory.join(page.get_output_path());
|
||||||
let dependency_manager =
|
let dependency_manager =
|
||||||
std::sync::Arc::new(std::sync::Mutex::new(DependencyManager::new()));
|
std::sync::Arc::new(std::sync::Mutex::new(DependencyManager::new()));
|
||||||
@@ -115,7 +120,17 @@ impl SiteRenderer {
|
|||||||
pub(crate) async fn render_blog_posts(&self, config: &Config) -> Result<(), CustomError> {
|
pub(crate) async fn render_blog_posts(&self, config: &Config) -> Result<(), CustomError> {
|
||||||
let renderer_integration = self.init_renderer_integration()?;
|
let renderer_integration = self.init_renderer_integration()?;
|
||||||
|
|
||||||
for blog_post in &self.blog_posts {
|
for blog_post in self.blog_posts.iter().filter(|blog_post| {
|
||||||
|
match blog_post
|
||||||
|
.get_index_page()
|
||||||
|
.expect("Blog posts should have an index page.")
|
||||||
|
.natter_publish
|
||||||
|
{
|
||||||
|
PublishStatus::Full => true,
|
||||||
|
PublishStatus::Unlisted => true,
|
||||||
|
PublishStatus::Unpublished => false,
|
||||||
|
}
|
||||||
|
}) {
|
||||||
for blog_post_page in &blog_post.pages {
|
for blog_post_page in &blog_post.pages {
|
||||||
let output_path = self
|
let output_path = self
|
||||||
.output_directory
|
.output_directory
|
||||||
@@ -155,7 +170,21 @@ impl SiteRenderer {
|
|||||||
|
|
||||||
// Sort blog posts by date, newest first.
|
// Sort blog posts by date, newest first.
|
||||||
let sorted_blog_posts = {
|
let sorted_blog_posts = {
|
||||||
let mut sorted_blog_posts: Vec<_> = self.blog_posts.iter().collect();
|
let mut sorted_blog_posts: Vec<_> = self
|
||||||
|
.blog_posts
|
||||||
|
.iter()
|
||||||
|
.filter(|blog_post| {
|
||||||
|
match blog_post
|
||||||
|
.get_index_page()
|
||||||
|
.expect("Blog posts should have an index page.")
|
||||||
|
.natter_publish
|
||||||
|
{
|
||||||
|
PublishStatus::Full => true,
|
||||||
|
PublishStatus::Unlisted => false,
|
||||||
|
PublishStatus::Unpublished => false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
sorted_blog_posts
|
sorted_blog_posts
|
||||||
.sort_by_key(|blog_post| (blog_post.get_date(), blog_post.id.as_str()));
|
.sort_by_key(|blog_post| (blog_post.get_date(), blog_post.id.as_str()));
|
||||||
sorted_blog_posts.reverse();
|
sorted_blog_posts.reverse();
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ use crate::cli::parameters::BuildArgs;
|
|||||||
use crate::command::build::render::SiteRenderer;
|
use crate::command::build::render::SiteRenderer;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::get_org_files;
|
|
||||||
use crate::intermediate::BlogPost;
|
use crate::intermediate::BlogPost;
|
||||||
use crate::intermediate::IPage;
|
use crate::intermediate::IPage;
|
||||||
use crate::intermediate::IntermediateContext;
|
use crate::intermediate::IntermediateContext;
|
||||||
use crate::intermediate::PageInput;
|
use crate::intermediate::PageInput;
|
||||||
use crate::intermediate::Registry;
|
use crate::intermediate::Registry;
|
||||||
use crate::walk_fs::walk_fs;
|
use crate::intermediate::get_org_files;
|
||||||
use crate::walk_fs::WalkAction;
|
use crate::walk_fs::WalkAction;
|
||||||
use crate::walk_fs::WalkFsFilterResult;
|
use crate::walk_fs::WalkFsFilterResult;
|
||||||
use include_dir::include_dir;
|
use crate::walk_fs::walk_fs;
|
||||||
use include_dir::Dir;
|
use include_dir::Dir;
|
||||||
|
use include_dir::include_dir;
|
||||||
use tokio::fs::DirEntry;
|
use tokio::fs::DirEntry;
|
||||||
|
|
||||||
static DEFAULT_STYLESHEETS: Dir =
|
static DEFAULT_STYLESHEETS: Dir =
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ use serde::Serialize;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IAstNode;
|
use crate::intermediate::IAstNode;
|
||||||
|
|
||||||
|
use super::RenderHeading;
|
||||||
|
use super::RenderSection;
|
||||||
use super::angle_link::RenderAngleLink;
|
use super::angle_link::RenderAngleLink;
|
||||||
use super::babel_call::RenderBabelCall;
|
use super::babel_call::RenderBabelCall;
|
||||||
use super::bold::RenderBold;
|
use super::bold::RenderBold;
|
||||||
@@ -55,8 +57,6 @@ use super::timestamp::RenderTimestamp;
|
|||||||
use super::underline::RenderUnderline;
|
use super::underline::RenderUnderline;
|
||||||
use super::verbatim::RenderVerbatim;
|
use super::verbatim::RenderVerbatim;
|
||||||
use super::verse_block::RenderVerseBlock;
|
use super::verse_block::RenderVerseBlock;
|
||||||
use super::RenderHeading;
|
|
||||||
use super::RenderSection;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ use serde::Serialize;
|
|||||||
use super::render_context::RenderContext;
|
use super::render_context::RenderContext;
|
||||||
use crate::context::macros::push_file;
|
use crate::context::macros::push_file;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::get_web_path;
|
|
||||||
use crate::intermediate::BlogPost;
|
use crate::intermediate::BlogPost;
|
||||||
use crate::intermediate::BlogPostPage;
|
use crate::intermediate::BlogPostPage;
|
||||||
|
use crate::intermediate::get_web_path;
|
||||||
|
|
||||||
use super::footnote_definition::RenderRealFootnoteDefinition;
|
|
||||||
use super::macros::render;
|
|
||||||
use super::GlobalSettings;
|
use super::GlobalSettings;
|
||||||
use super::PageHeader;
|
use super::PageHeader;
|
||||||
use super::RenderDocumentElement;
|
use super::RenderDocumentElement;
|
||||||
|
use super::footnote_definition::RenderRealFootnoteDefinition;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct RenderBlogPostPageInput<'a> {
|
pub(crate) struct RenderBlogPostPageInput<'a> {
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ use serde::Serialize;
|
|||||||
|
|
||||||
use super::macros::render;
|
use super::macros::render;
|
||||||
use super::render_context::RenderContext;
|
use super::render_context::RenderContext;
|
||||||
use crate::context::macros::push_file;
|
|
||||||
use crate::context::RenderDocumentElement;
|
use crate::context::RenderDocumentElement;
|
||||||
use crate::context::RenderRealFootnoteDefinition;
|
use crate::context::RenderRealFootnoteDefinition;
|
||||||
|
use crate::context::macros::push_file;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::get_web_path;
|
|
||||||
use crate::intermediate::BlogPost;
|
use crate::intermediate::BlogPost;
|
||||||
|
use crate::intermediate::get_web_path;
|
||||||
|
|
||||||
use super::GlobalSettings;
|
use super::GlobalSettings;
|
||||||
use super::PageHeader;
|
use super::PageHeader;
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ use serde::Serialize;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IBold;
|
use crate::intermediate::IBold;
|
||||||
|
|
||||||
|
use super::RenderObject;
|
||||||
use super::macros::render;
|
use super::macros::render;
|
||||||
use super::render_context::RenderContext;
|
use super::render_context::RenderContext;
|
||||||
use super::RenderObject;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IDocumentElement;
|
use crate::intermediate::IDocumentElement;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderHeading;
|
use super::RenderHeading;
|
||||||
use super::RenderSection;
|
use super::RenderSection;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IHeading;
|
use crate::intermediate::IHeading;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderDocumentElement;
|
use super::RenderDocumentElement;
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IItalic;
|
use crate::intermediate::IItalic;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use super::footnote_definition::RenderRealFootnoteDefinition;
|
|
||||||
use super::macros::render;
|
|
||||||
use super::render_context::RenderContext;
|
|
||||||
use super::GlobalSettings;
|
use super::GlobalSettings;
|
||||||
use super::PageHeader;
|
use super::PageHeader;
|
||||||
use super::RenderDocumentElement;
|
use super::RenderDocumentElement;
|
||||||
|
use super::footnote_definition::RenderRealFootnoteDefinition;
|
||||||
|
use super::macros::render;
|
||||||
|
use super::render_context::RenderContext;
|
||||||
use crate::context::macros::push_file;
|
use crate::context::macros::push_file;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::get_web_path;
|
|
||||||
use crate::intermediate::IPage;
|
use crate::intermediate::IPage;
|
||||||
|
use crate::intermediate::get_web_path;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IParagraph;
|
use crate::intermediate::IParagraph;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IPlainListItem;
|
use crate::intermediate::IPlainListItem;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderElement;
|
use super::RenderElement;
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IPlainListSimpleItem;
|
use crate::intermediate::IPlainListSimpleItem;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
/// Special case for list items with only paragraphs and sublists as their children. In those cases, the paragraph tags are omitted. This is equivalent to a Paragraph but in a different struct to have a different type tag.
|
/// Special case for list items with only paragraphs and sublists as their children. In those cases, the paragraph tags are omitted. This is equivalent to a Paragraph but in a different struct to have a different type tag.
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IQuoteBlock;
|
use crate::intermediate::IQuoteBlock;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderElement;
|
use super::RenderElement;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use crate::error::CustomError;
|
|||||||
use crate::intermediate::IRegularLink;
|
use crate::intermediate::IRegularLink;
|
||||||
use crate::intermediate::LinkTarget;
|
use crate::intermediate::LinkTarget;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::ISection;
|
use crate::intermediate::ISection;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderElement;
|
use super::RenderElement;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IStrikeThrough;
|
use crate::intermediate::IStrikeThrough;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::ITableCell;
|
use crate::intermediate::ITableCell;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use super::render_context::RenderContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IUnderline;
|
use crate::intermediate::IUnderline;
|
||||||
|
|
||||||
use super::macros::render;
|
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
use super::macros::render;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
|||||||
@@ -1,28 +1,3 @@
|
|||||||
use super::angle_link::IAngleLink;
|
|
||||||
use super::bold::IBold;
|
|
||||||
use super::citation::ICitation;
|
|
||||||
use super::citation_reference::ICitationReference;
|
|
||||||
use super::code::ICode;
|
|
||||||
use super::comment::IComment;
|
|
||||||
use super::entity::IEntity;
|
|
||||||
use super::export_snippet::IExportSnippet;
|
|
||||||
use super::footnote_reference::IFootnoteReference;
|
|
||||||
use super::inline_babel_call::IInlineBabelCall;
|
|
||||||
use super::inline_source_block::IInlineSourceBlock;
|
|
||||||
use super::italic::IItalic;
|
|
||||||
use super::keyword::IKeyword;
|
|
||||||
use super::latex_fragment::ILatexFragment;
|
|
||||||
use super::line_break::ILineBreak;
|
|
||||||
use super::org_macro::IOrgMacro;
|
|
||||||
use super::plain_link::IPlainLink;
|
|
||||||
use super::plain_text::IPlainText;
|
|
||||||
use super::radio_link::IRadioLink;
|
|
||||||
use super::radio_target::IRadioTarget;
|
|
||||||
use super::regular_link::IRegularLink;
|
|
||||||
use super::statistics_cookie::IStatisticsCookie;
|
|
||||||
use super::strike_through::IStrikeThrough;
|
|
||||||
use super::subscript::ISubscript;
|
|
||||||
use super::superscript::ISuperscript;
|
|
||||||
use super::IBabelCall;
|
use super::IBabelCall;
|
||||||
use super::ICenterBlock;
|
use super::ICenterBlock;
|
||||||
use super::IClock;
|
use super::IClock;
|
||||||
@@ -52,6 +27,31 @@ use super::IUnderline;
|
|||||||
use super::IVerbatim;
|
use super::IVerbatim;
|
||||||
use super::IVerseBlock;
|
use super::IVerseBlock;
|
||||||
use super::IntermediateContext;
|
use super::IntermediateContext;
|
||||||
|
use super::angle_link::IAngleLink;
|
||||||
|
use super::bold::IBold;
|
||||||
|
use super::citation::ICitation;
|
||||||
|
use super::citation_reference::ICitationReference;
|
||||||
|
use super::code::ICode;
|
||||||
|
use super::comment::IComment;
|
||||||
|
use super::entity::IEntity;
|
||||||
|
use super::export_snippet::IExportSnippet;
|
||||||
|
use super::footnote_reference::IFootnoteReference;
|
||||||
|
use super::inline_babel_call::IInlineBabelCall;
|
||||||
|
use super::inline_source_block::IInlineSourceBlock;
|
||||||
|
use super::italic::IItalic;
|
||||||
|
use super::keyword::IKeyword;
|
||||||
|
use super::latex_fragment::ILatexFragment;
|
||||||
|
use super::line_break::ILineBreak;
|
||||||
|
use super::org_macro::IOrgMacro;
|
||||||
|
use super::plain_link::IPlainLink;
|
||||||
|
use super::plain_text::IPlainText;
|
||||||
|
use super::radio_link::IRadioLink;
|
||||||
|
use super::radio_target::IRadioTarget;
|
||||||
|
use super::regular_link::IRegularLink;
|
||||||
|
use super::statistics_cookie::IStatisticsCookie;
|
||||||
|
use super::strike_through::IStrikeThrough;
|
||||||
|
use super::subscript::ISubscript;
|
||||||
|
use super::superscript::ISuperscript;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use futures::future::{BoxFuture, FutureExt};
|
use futures::future::{BoxFuture, FutureExt};
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ use tokio::fs::DirEntry;
|
|||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
use crate::intermediate::IntermediateContext;
|
||||||
use crate::intermediate::blog_post_page::BlogPostPageInput;
|
use crate::intermediate::blog_post_page::BlogPostPageInput;
|
||||||
use crate::intermediate::registry::Registry;
|
use crate::intermediate::registry::Registry;
|
||||||
use crate::intermediate::IntermediateContext;
|
|
||||||
use crate::walk_fs::walk_fs;
|
|
||||||
use crate::walk_fs::WalkAction;
|
use crate::walk_fs::WalkAction;
|
||||||
use crate::walk_fs::WalkFsFilterResult;
|
use crate::walk_fs::WalkFsFilterResult;
|
||||||
|
use crate::walk_fs::walk_fs;
|
||||||
|
|
||||||
use super::BlogPostPage;
|
use super::BlogPostPage;
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ use crate::error::CustomError;
|
|||||||
|
|
||||||
use super::footnote_definition::IRealFootnoteDefinition;
|
use super::footnote_definition::IRealFootnoteDefinition;
|
||||||
|
|
||||||
use super::macros::intermediate;
|
|
||||||
use super::IDocumentElement;
|
use super::IDocumentElement;
|
||||||
use super::IHeading;
|
use super::IHeading;
|
||||||
use super::ISection;
|
use super::ISection;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct BlogPostPageInput<'b, 'parse> {
|
pub(crate) struct BlogPostPageInput<'b, 'parse> {
|
||||||
@@ -48,6 +48,16 @@ pub(crate) struct BlogPostPage {
|
|||||||
pub(crate) children: Vec<IDocumentElement>,
|
pub(crate) children: Vec<IDocumentElement>,
|
||||||
|
|
||||||
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
||||||
|
|
||||||
|
pub(crate) natter_publish: PublishStatus,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
pub(crate) enum PublishStatus {
|
||||||
|
#[default]
|
||||||
|
Full,
|
||||||
|
Unlisted,
|
||||||
|
Unpublished,
|
||||||
}
|
}
|
||||||
|
|
||||||
intermediate!(
|
intermediate!(
|
||||||
@@ -93,6 +103,7 @@ intermediate!(
|
|||||||
date: get_date(original.document),
|
date: get_date(original.document),
|
||||||
children,
|
children,
|
||||||
footnotes,
|
footnotes,
|
||||||
|
natter_publish: get_publish_status(original.document).unwrap_or_default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -129,3 +140,25 @@ pub(crate) fn get_date(document: &organic::types::Document<'_>) -> Option<String
|
|||||||
.last()
|
.last()
|
||||||
.map(|kw| kw.value.to_owned())
|
.map(|kw| kw.value.to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_publish_status(document: &organic::types::Document<'_>) -> Option<PublishStatus> {
|
||||||
|
let publish_string = organic::types::AstNode::from(document)
|
||||||
|
.iter_all_ast_nodes()
|
||||||
|
.filter_map(|node| match node {
|
||||||
|
organic::types::AstNode::Keyword(kw)
|
||||||
|
if kw.key.eq_ignore_ascii_case("natter_publish") =>
|
||||||
|
{
|
||||||
|
Some(kw)
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.last()
|
||||||
|
.map(|kw| kw.value);
|
||||||
|
match publish_string {
|
||||||
|
Some("full") => Some(PublishStatus::Full),
|
||||||
|
Some("unlisted") => Some(PublishStatus::Unlisted),
|
||||||
|
Some("unpublished") => Some(PublishStatus::Unpublished),
|
||||||
|
Some(status) => panic!("Unrecognized publish status: {}", status),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
use super::macros::intermediate;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
use super::IPlainListSimpleItem;
|
||||||
use super::comment::IComment;
|
use super::comment::IComment;
|
||||||
use super::keyword::IKeyword;
|
use super::keyword::IKeyword;
|
||||||
use super::macros::iselector;
|
use super::macros::iselector;
|
||||||
use super::IPlainListSimpleItem;
|
|
||||||
|
|
||||||
use super::IBabelCall;
|
use super::IBabelCall;
|
||||||
use super::ICenterBlock;
|
use super::ICenterBlock;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::registry::register_footnote_definition;
|
|
||||||
use super::IAstNode;
|
use super::IAstNode;
|
||||||
use super::IntermediateContext;
|
use super::IntermediateContext;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
use super::registry::register_footnote_definition;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IDocumentElement;
|
use super::IDocumentElement;
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
use super::macros::intermediate;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
|
|||||||
@@ -71,9 +71,10 @@ mod verse_block;
|
|||||||
pub(crate) use angle_link::IAngleLink;
|
pub(crate) use angle_link::IAngleLink;
|
||||||
pub(crate) use ast_node::IAstNode;
|
pub(crate) use ast_node::IAstNode;
|
||||||
pub(crate) use babel_call::IBabelCall;
|
pub(crate) use babel_call::IBabelCall;
|
||||||
pub(crate) use blog_post::get_org_files;
|
|
||||||
pub(crate) use blog_post::BlogPost;
|
pub(crate) use blog_post::BlogPost;
|
||||||
|
pub(crate) use blog_post::get_org_files;
|
||||||
pub(crate) use blog_post_page::BlogPostPage;
|
pub(crate) use blog_post_page::BlogPostPage;
|
||||||
|
pub(crate) use blog_post_page::PublishStatus;
|
||||||
pub(crate) use bold::IBold;
|
pub(crate) use bold::IBold;
|
||||||
pub(crate) use center_block::ICenterBlock;
|
pub(crate) use center_block::ICenterBlock;
|
||||||
pub(crate) use citation::ICitation;
|
pub(crate) use citation::ICitation;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use super::plain_text::IPlainText;
|
|||||||
use super::radio_link::IRadioLink;
|
use super::radio_link::IRadioLink;
|
||||||
use super::radio_target::IRadioTarget;
|
use super::radio_target::IRadioTarget;
|
||||||
|
|
||||||
|
use super::ITarget;
|
||||||
use super::regular_link::IRegularLink;
|
use super::regular_link::IRegularLink;
|
||||||
use super::statistics_cookie::IStatisticsCookie;
|
use super::statistics_cookie::IStatisticsCookie;
|
||||||
use super::strike_through::IStrikeThrough;
|
use super::strike_through::IStrikeThrough;
|
||||||
@@ -29,7 +30,6 @@ use super::superscript::ISuperscript;
|
|||||||
use super::timestamp::ITimestamp;
|
use super::timestamp::ITimestamp;
|
||||||
use super::underline::IUnderline;
|
use super::underline::IUnderline;
|
||||||
use super::verbatim::IVerbatim;
|
use super::verbatim::IVerbatim;
|
||||||
use super::ITarget;
|
|
||||||
use futures::future::{BoxFuture, FutureExt};
|
use futures::future::{BoxFuture, FutureExt};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
use super::blog_post_page::get_date;
|
|
||||||
use super::blog_post_page::get_title;
|
|
||||||
use super::footnote_definition::IRealFootnoteDefinition;
|
|
||||||
use super::macros::intermediate;
|
|
||||||
use super::IDocumentElement;
|
use super::IDocumentElement;
|
||||||
use super::IHeading;
|
use super::IHeading;
|
||||||
use super::ISection;
|
use super::ISection;
|
||||||
|
use super::PublishStatus;
|
||||||
|
use super::blog_post_page::get_date;
|
||||||
|
use super::blog_post_page::get_publish_status;
|
||||||
|
use super::blog_post_page::get_title;
|
||||||
|
use super::footnote_definition::IRealFootnoteDefinition;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
@@ -24,6 +26,8 @@ pub(crate) struct IPage {
|
|||||||
pub(crate) children: Vec<IDocumentElement>,
|
pub(crate) children: Vec<IDocumentElement>,
|
||||||
|
|
||||||
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
||||||
|
|
||||||
|
pub(crate) natter_publish: PublishStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
intermediate!(
|
intermediate!(
|
||||||
@@ -69,6 +73,7 @@ intermediate!(
|
|||||||
date: get_date(original.document),
|
date: get_date(original.document),
|
||||||
children,
|
children,
|
||||||
footnotes,
|
footnotes,
|
||||||
|
natter_publish: get_publish_status(original.document).unwrap_or_default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IPlainListItem;
|
use super::IPlainListItem;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IPlainListSimpleItem;
|
use super::IPlainListSimpleItem;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
|
||||||
use super::IElement;
|
use super::IElement;
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IElement;
|
use super::IElement;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ use organic::types::Element;
|
|||||||
use organic::types::Object;
|
use organic::types::Object;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use super::ast_node::IAstNode;
|
|
||||||
use super::ast_node::IntoIAstNode;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
use super::IParagraph;
|
use super::IParagraph;
|
||||||
use super::IntermediateContext;
|
use super::IntermediateContext;
|
||||||
|
use super::ast_node::IAstNode;
|
||||||
|
use super::ast_node::IntoIAstNode;
|
||||||
|
|
||||||
type IdCounter = u16;
|
type IdCounter = u16;
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ use organic::types::LinkType;
|
|||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
use super::IntermediateContext;
|
||||||
use super::get_web_path;
|
use super::get_web_path;
|
||||||
use super::macros::intermediate;
|
use super::macros::intermediate;
|
||||||
use super::IntermediateContext;
|
|
||||||
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
use crate::context::RenderContext;
|
use crate::context::RenderContext;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::macros::intermediate;
|
|
||||||
use super::IElement;
|
use super::IElement;
|
||||||
|
use super::macros::intermediate;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
use super::macros::intermediate;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use organic::types::StandardProperties;
|
use organic::types::StandardProperties;
|
||||||
|
|
||||||
use super::macros::intermediate;
|
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
use super::macros::intermediate;
|
||||||
|
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![feature(let_chains)]
|
|
||||||
use std::process::ExitCode;
|
use std::process::ExitCode;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|||||||
Reference in New Issue
Block a user