Skip to content

Commit

Permalink
feat(ssg): ✨ 0.0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Sep 9, 2024
1 parent b73ce7f commit 4a9384e
Show file tree
Hide file tree
Showing 18 changed files with 798 additions and 1,324 deletions.
1,917 changes: 687 additions & 1,230 deletions Cargo.lock

Large diffs are not rendered by default.

73 changes: 44 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ license = "MIT OR Apache-2.0"
name = "ssg"
readme = "README.md"
repository = "https://github.com/sebastienrousseau/shokunin"
rust-version = "1.60.0"
version = "0.0.29"
rust-version = "1.56.0"
version = "0.0.30"
include = [
"/CONTRIBUTING.md",
"/LICENSE-APACHE",
Expand All @@ -42,26 +42,26 @@ harness = false
path = "benches/bench.rs"

[dependencies]
clap = "4.5.16"
comrak = "0.24.1"
dtt = "0.0.6"
env_logger = "0.11.5"
lazy_static = "1.5.0"
log = { version = "0.4.22", features = ["std"] }
minify-html = "0.15.0"
pdf_composer = "0.2.71"
pulldown-cmark = "0.12.1"
quick-xml = "0.36.1"
regex = "1.10.6"
reqwest = { version = "0.12.7", features = ["blocking", "json"] }
rlg = "0.0.4"
serde = { version = "1.0.209", features = ["derive"] }
serde_json = "1.0.128"
tempfile = "3.12.0"
toml = "0.8.19"
uuid = { version = "1.10.0", features = ["v4"] }
vrd = "0.0.7"
yaml-rust = "0.4.5"
anyhow = "1.0"
clap = "4.5"
comrak = "0.28"
dtt = "0.0.8"
env_logger = "0.11"
lazy_static = "1.5"
log = { version = "0.4", features = ["std"] }
minify-html = "0.15"
pulldown-cmark = "0.12"
quick-xml = "0.36"
regex = "1.10"
reqwest = { version = "0.12", features = ["blocking", "json"] }
rlg = "0.0.6"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0"
tempfile = "3.12"
toml = "0.8"
yaml-rust = "0.4.4"
uuid = { version = "1.10", features = ["v4"] }
vrd = "0.0.8"

# Unix platforms use OpenSSL for now to provide SSL functionality
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
Expand All @@ -77,23 +77,33 @@ name = "ssg"
path = "src/lib.rs"

[features]
# No default features
default = []
bench = []

[package.metadata.docs.rs]
# Specify arguments for rustdoc to enhance documentation quality.
rustdoc-args = [
"--generate-link-to-definition",
"--cfg", "docsrs",
"--document-private-items",
]
# Build docs with all crate features enabled to cover the entire API.
all-features = true
# Target platform for the docs, ensuring compatibility with common Linux servers.
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--generate-link-to-definition"]

# Linting config
[lints.rust]

## Warn
# box_pointers = "warn"
box_pointers = "warn"
missing_copy_implementations = "warn"
missing_docs = "warn"
unstable_features = "warn"
# unused_crate_dependencies = "warn"
unused_extern_crates = "warn"
# unused_results = "warn"
unused_results = "warn"

## Allow
bare_trait_objects = "allow"
Expand All @@ -114,18 +124,17 @@ deprecated_in_future = "deny"
ellipsis_inclusive_range_patterns = "deny"
explicit_outlives_requirements = "deny"
future_incompatible = { level = "deny", priority = -1 }
keyword_idents = "deny"
keyword_idents = { level = "deny", priority = -1 }
macro_use_extern_crate = "deny"
meta_variable_misuse = "deny"
missing_fragment_specifier = "deny"
noop_method_call = "deny"
pointer_structural_match = "deny"
rust_2018_idioms = { level = "deny", priority = -1 }
rust_2021_compatibility = { level = "deny", priority = -1 }
unused = { level = "deny", priority = -1 }
single_use_lifetimes = "deny"
trivial_casts = "deny"
trivial_numeric_casts = "deny"
unused = { level = "deny", priority = -1 }
unused_features = "deny"
unused_import_braces = "deny"
unused_labels = "deny"
Expand All @@ -134,8 +143,14 @@ unused_macro_rules = "deny"
unused_qualifications = "deny"
variant_size_differences = "deny"


[package.metadata.clippy]
warn-lints = ["clippy::all", "clippy::pedantic", "clippy::cargo", "clippy::nursery"]
warn-lints = [
"clippy::all",
"clippy::pedantic",
"clippy::cargo",
"clippy::nursery",
]

[profile.dev]
codegen-units = 256
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ following to your `Cargo.toml` file:

```toml
[dependencies]
shokunin = "0.0.29"
shokunin = "0.0.30"
```

Add the following to your `main.rs` file:
Expand Down Expand Up @@ -306,6 +306,6 @@ of useful suggestions on how to improve this project.
[crates-badge]: https://img.shields.io/crates/v/ssg.svg?style=for-the-badge 'Crates.io badge'
[divider]: https://kura.pro/common/images/elements/divider.svg "divider"
[docs-badge]: https://img.shields.io/docsrs/ssg.svg?style=for-the-badge 'Docs.rs badge'
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.0.29-orange.svg?style=for-the-badge 'Lib.rs badge'
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.0.30-orange.svg?style=for-the-badge 'Lib.rs badge'
[license-badge]: https://img.shields.io/crates/l/ssg.svg?style=for-the-badge 'License badge'
[made-with-rust-badge]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust 'Made With Rust badge'
2 changes: 1 addition & 1 deletion TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<!-- markdownlint-enable MD033 MD041 -->

# Shokunin Static Site Generator (SSG) v0.0.29 🦀
# Shokunin Static Site Generator (SSG) v0.0.30 🦀

The fastest Rust-based Static Site Generator (SSG) for building professional
websites and blogs.
Expand Down
2 changes: 1 addition & 1 deletion content/404.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ viewport: "width=device-width, initial-scale=1, shrink-to-fit=no"
atom_link: "https://kaishi.one/404/rss.xml"
category: "Technology"
docs: "https://validator.w3.org/feed/docs/rss2.html"
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: "The page may have been removed or renamed. Please visit our homepage for more information."
item_guid: "https://kaishi.one/404/rss.xml"
item_link: "https://kaishi.one/404/rss.xml"
Expand Down
2 changes: 1 addition & 1 deletion content/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ news_title: "Contact Us" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/contact/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the contact page of the Kaishi website.
item_guid: https://kaishi.one/contact/rss.xml
item_link: https://kaishi.one/contact/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ news_title: "Features" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ news_title: "Kaishi, a Shokunin Static Site Generator Starter Template" ## The t
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/offline.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ news_title: "Offline" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/post.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ news_title: "Posts" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ news_title: "Privacy" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ news_title: "Tags" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
2 changes: 1 addition & 1 deletion content/terms.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ news_title: "Terms" ## The title of the page. (max 64 characters)
atom_link: https://kaishi.one/rss.xml
category: "Technology"
docs: https://validator.w3.org/feed/docs/rss2.html
generator: "Shokunin SSG (version 0.0.29)"
generator: "Shokunin SSG (version 0.0.30)"
item_description: RSS feed for the site
item_guid: https://kaishi.one/rss.xml
item_link: https://kaishi.one/rss.xml
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn build() -> Result<ArgMatches, Error> {
.author("Sebastien Rousseau")
.about("")
.bin_name("ssg")
.version("0.0.29")
.version("0.0.30")
.arg(
Arg::new("new")
.help("Create a new project.")
Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn build() -> Result<ArgMatches, Error> {
/// ```
pub fn print_banner() {
// Set the title and description for the CLI
let title = "Shokunin (ssg) 🦀 v0.0.29";
let title = "Shokunin (ssg) 🦀 v0.0.30";
let description =
"A Fast and Flexible Static Site Generator written in Rust";

Expand Down
78 changes: 39 additions & 39 deletions src/compiler/service.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright © 2024 Shokunin Static Site Generator. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use pdf_composer::{
FontsStandard, PDFComposer, PDFDocInfoEntry, PDFVersion,
PaperOrientation, PaperSize,
};
// use pdf_composer::{
// FontsStandard, PDFComposer, PDFDocInfoEntry, PDFVersion,
// PaperOrientation, PaperSize,
// };
use rlg::log_level::LogLevel::ERROR;

// use crate::modules::pdf::generate_pdf;
Expand Down Expand Up @@ -39,7 +39,7 @@ use std::{
collections::HashMap,
error::Error,
fs,
path::{Path, PathBuf},
path::Path,
};

/// Compiles files in a source directory, generates HTML pages from them, and
Expand Down Expand Up @@ -107,40 +107,40 @@ pub fn compile(
});

// Determine the filename without the extension
let filename_without_extension = Path::new(&file.name)
.file_stem()
.and_then(|stem| stem.to_str())
.unwrap_or(&file.name);
let common_path = build_dir_path.to_str().unwrap();

let mut pdf_source_paths: Vec<PathBuf> = Vec::new();
let source_for_pdf =
Path::new(content_path).join(&file.name);
pdf_source_paths.push(source_for_pdf);
let mut pdf_instance = PDFComposer::new();
pdf_instance.set_pdf_version(PDFVersion::V1_7);
pdf_instance.set_paper_size(PaperSize::A5);
pdf_instance.set_orientation(PaperOrientation::Landscape);
pdf_instance.set_margins("20");
pdf_instance.set_font(FontsStandard::TimesRoman);
pdf_instance.add_source_files(pdf_source_paths);
let author_entry = PDFDocInfoEntry {
doc_info_entry: "Author",
yaml_entry: "author",
};
let generator_entry = PDFDocInfoEntry {
doc_info_entry: "generator",
yaml_entry: "generator",
};
pdf_instance.set_doc_info_entry(author_entry);
pdf_instance.set_doc_info_entry(generator_entry);
let pdf_destination =
Path::new(common_path).join(filename_without_extension);
pdf_instance.set_output_directory(
pdf_destination.to_str().unwrap(),
);

pdf_instance.generate_pdfs();
// let filename_without_extension = Path::new(&file.name)
// .file_stem()
// .and_then(|stem| stem.to_str())
// .unwrap_or(&file.name);
// let common_path = build_dir_path.to_str().unwrap();

// let mut pdf_source_paths: Vec<PathBuf> = Vec::new();
// let source_for_pdf =
// Path::new(content_path).join(&file.name);
// pdf_source_paths.push(source_for_pdf);
// let mut pdf_instance = PDFComposer::new();
// pdf_instance.set_pdf_version(PDFVersion::V1_7);
// pdf_instance.set_paper_size(PaperSize::A5);
// pdf_instance.set_orientation(PaperOrientation::Landscape);
// pdf_instance.set_margins("20");
// pdf_instance.set_font(FontsStandard::TimesRoman);
// pdf_instance.add_source_files(pdf_source_paths);
// let author_entry = PDFDocInfoEntry {
// doc_info_entry: "Author",
// yaml_entry: "author",
// };
// let generator_entry = PDFDocInfoEntry {
// doc_info_entry: "generator",
// yaml_entry: "generator",
// };
// pdf_instance.set_doc_info_entry(author_entry);
// pdf_instance.set_doc_info_entry(generator_entry);
// let pdf_destination =
// Path::new(common_path).join(filename_without_extension);
// pdf_instance.set_output_directory(
// pdf_destination.to_str().unwrap(),
// );

// pdf_instance.generate_pdfs();

// Create page options
let mut page_options = PageOptions::new();
Expand Down
Loading

0 comments on commit 4a9384e

Please sign in to comment.