Compare commits

...

2 Commits

Author SHA1 Message Date
Tom Alexander
b06798f23f Prepare for publishing to crates.io. 2023-12-21 19:40:28 -05:00
Tom Alexander
35dff5cdaf Rename to natter. 2023-12-21 19:28:31 -05:00
9 changed files with 47 additions and 115 deletions

120
Cargo.lock generated
View File

@@ -17,15 +17,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.4" version = "0.6.4"
@@ -188,7 +179,8 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]] [[package]]
name = "duster" name = "duster"
version = "0.1.1" version = "0.1.1"
source = "git+https://code.fizz.buzz/talexander/duster.git?branch=master#3428a3f5097c7d2cc252d1bfd9aae7771553ab69" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17d19cdf8e1ae4aead0978a30e99817af1c36abaf22f81901952b1310abb6989"
dependencies = [ dependencies = [
"nom 6.1.2", "nom 6.1.2",
"serde", "serde",
@@ -355,12 +347,6 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "lexical-core" name = "lexical-core"
version = "0.7.6" version = "0.7.6"
@@ -401,6 +387,22 @@ dependencies = [
"adler", "adler",
] ]
[[package]]
name = "natter"
version = "0.0.1"
dependencies = [
"clap",
"duster",
"futures",
"include_dir",
"organic",
"serde",
"serde_json",
"tokio",
"toml",
"walkdir",
]
[[package]] [[package]]
name = "nom" name = "nom"
version = "6.1.2" version = "6.1.2"
@@ -489,35 +491,6 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
[[package]]
name = "regex"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.23" version = "0.1.23"
@@ -611,26 +584,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "thiserror"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.33.0" version = "1.33.0"
@@ -677,26 +630,6 @@ dependencies = [
"winnow", "winnow",
] ]
[[package]]
name = "tree-sitter"
version = "0.20.10"
source = "git+https://github.com/tree-sitter/tree-sitter.git?rev=52f7eaff3182a726eb064a91d4e49dfbaecd4ee3#52f7eaff3182a726eb064a91d4e49dfbaecd4ee3"
dependencies = [
"cc",
"regex",
]
[[package]]
name = "tree-sitter-highlight"
version = "0.20.2"
source = "git+https://github.com/tree-sitter/tree-sitter.git?rev=52f7eaff3182a726eb064a91d4e49dfbaecd4ee3#52f7eaff3182a726eb064a91d4e49dfbaecd4ee3"
dependencies = [
"lazy_static",
"regex",
"thiserror",
"tree-sitter",
]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.12" version = "1.0.12"
@@ -831,23 +764,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "writer"
version = "0.0.1"
dependencies = [
"clap",
"duster",
"futures",
"include_dir",
"organic",
"serde",
"serde_json",
"tokio",
"toml",
"tree-sitter-highlight",
"walkdir",
]
[[package]] [[package]]
name = "wyz" name = "wyz"
version = "0.2.0" version = "0.2.0"

View File

@@ -1,14 +1,27 @@
[package] [package]
name = "writer" name = "natter"
version = "0.0.1" version = "0.0.1"
edition = "2021" edition = "2021"
authors = ["Tom Alexander <tom@fizz.buzz>"]
description = "A static site generator using org source files."
license = "0BSD"
repository = "https://code.fizz.buzz/talexander/natter"
readme = "README.md"
keywords = ["static", "site", "generator"]
categories = ["command-line-utilities"]
resolver = "2"
include = [
"LICENSE",
"**/*.rs",
"Cargo.toml",
"Cargo.lock",
"default_environment/"
]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
clap = { version = "4.4.6", default-features = false, features = ["std", "color", "help", "derive"] } clap = { version = "4.4.6", default-features = false, features = ["std", "color", "help", "derive"] }
duster = { git = "https://code.fizz.buzz/talexander/duster.git", branch = "master" } duster = "0.1.1"
tree-sitter-highlight = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "52f7eaff3182a726eb064a91d4e49dfbaecd4ee3" }
futures = "0.3.29" futures = "0.3.29"
include_dir = "0.7.3" include_dir = "0.7.3"
# TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate. # TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate.

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# Natter
Natter is a static site generator for blogs using org as an input format. It is at a very early stage, and will have deep sweeping changes.

View File

@@ -4,7 +4,7 @@ use clap::Subcommand;
use std::path::PathBuf; use std::path::PathBuf;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(name = "Writer")] #[command(name = "Natter")]
#[command(version = env!("CARGO_PKG_VERSION"))] #[command(version = env!("CARGO_PKG_VERSION"))]
#[command(about = "Generate a static site.", long_about = None)] #[command(about = "Generate a static site.", long_about = None)]
#[command(propagate_version = true)] #[command(propagate_version = true)]
@@ -24,14 +24,14 @@ pub(crate) enum Commands {
#[derive(Args, Debug)] #[derive(Args, Debug)]
pub(crate) struct InitArgs { pub(crate) struct InitArgs {
/// Path where you want the initial writer structure to be located. /// Path where you want the initial natter structure to be located.
#[arg(short, long)] #[arg(short, long)]
pub(crate) path: PathBuf, pub(crate) path: PathBuf,
} }
#[derive(Args, Debug)] #[derive(Args, Debug)]
pub(crate) struct BuildArgs { pub(crate) struct BuildArgs {
/// Path to the writer config file. /// Path to the natter config file.
#[arg(short, long)] #[arg(short, long)]
pub(crate) config: PathBuf, pub(crate) config: PathBuf,
} }

View File

@@ -1,3 +1,3 @@
mod runner; mod runner;
pub(crate) use runner::init_writer_folder; pub(crate) use runner::init_natter_folder;

View File

@@ -2,7 +2,7 @@ use crate::cli::parameters::InitArgs;
use crate::config::Config; use crate::config::Config;
use crate::error::CustomError; use crate::error::CustomError;
pub(crate) async fn init_writer_folder(args: InitArgs) -> Result<(), CustomError> { pub(crate) async fn init_natter_folder(args: InitArgs) -> Result<(), CustomError> {
if args.path.exists() && !args.path.is_dir() { if args.path.exists() && !args.path.is_dir() {
return Err("The supplied path exists but is not a directory. Aborting.".into()); return Err("The supplied path exists but is not a directory. Aborting.".into());
} }

View File

@@ -17,7 +17,7 @@ pub(crate) struct Config {
impl Config { impl Config {
pub(crate) fn new<P: AsRef<Path>>(root_dir: P) -> Result<Config, CustomError> { pub(crate) fn new<P: AsRef<Path>>(root_dir: P) -> Result<Config, CustomError> {
fn inner(root_dir: &Path) -> Result<Config, CustomError> { fn inner(root_dir: &Path) -> Result<Config, CustomError> {
let file_path = root_dir.join("writer.toml"); let file_path = root_dir.join("natter.toml");
Ok(Config { Ok(Config {
raw: RawConfig::default(), raw: RawConfig::default(),
config_path: file_path, config_path: file_path,

View File

@@ -1,7 +1,7 @@
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
/// This is the struct for the writer.toml config file that ends up in each site's root directory. /// This is the struct for the natter.toml config file that ends up in each site's root directory.
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]
pub(crate) struct RawConfig { pub(crate) struct RawConfig {
pub(super) site_title: Option<String>, pub(super) site_title: Option<String>,

View File

@@ -6,7 +6,7 @@ use clap::Parser;
use self::cli::parameters::Cli; use self::cli::parameters::Cli;
use self::cli::parameters::Commands; use self::cli::parameters::Commands;
use self::command::build::build_site; use self::command::build::build_site;
use self::command::init::init_writer_folder; use self::command::init::init_natter_folder;
use self::error::CustomError; use self::error::CustomError;
mod cli; mod cli;
mod command; mod command;
@@ -28,7 +28,7 @@ async fn main_body() -> Result<ExitCode, CustomError> {
let args = Cli::parse(); let args = Cli::parse();
match args.command { match args.command {
Commands::Init(args) => { Commands::Init(args) => {
init_writer_folder(args).await?; init_natter_folder(args).await?;
} }
Commands::Build(args) => { Commands::Build(args) => {
build_site(args).await?; build_site(args).await?;