Skip to content

Commit

Permalink
release: 0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Feb 16, 2024
2 parents 2cc15fc + c014ae4 commit 7a30d14
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 95 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/msrv.yaml

This file was deleted.

14 changes: 7 additions & 7 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Project Dependencies
Package: yesvgmap
Version: 0.5.2
Generated: 2024-02-08 20:47:02 UTC
Version: 0.5.3
Generated: 2024-02-16 19:23:04 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.7 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
| [argyle](https://github.com/Blobfolio/argyle) | 0.7.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.8 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
| [argyle](https://github.com/Blobfolio/argyle) | 0.7.2 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [dowser](https://github.com/Blobfolio/dowser) | 0.8.2 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [dowser](https://github.com/Blobfolio/dowser) | 0.9.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [fastrand](https://github.com/smol-rs/fastrand) | 2.0.1 | [Stjepan Glavina](mailto:[email protected]) | Apache-2.0 or MIT |
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.12.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [svg](https://github.com/bodoni/svg) | 0.15.0 | [Adam Bryant](mailto:[email protected]), [Felix Schütt](mailto:[email protected]), [GeoffreyY](mailto:[email protected]), [Gijs Burghoorn](mailto:[email protected]), [Ivan Ukhov](mailto:[email protected]), [Jack Greenbaum](mailto:[email protected]), [Mike Wilkerson](mailto:[email protected]), [Nathan Hüsken](mailto:[email protected]), [Nathaniel Cook](mailto:[email protected]), [Nick Angelou](mailto:[email protected]), [Nicolas Silva](mailto:[email protected]), [Nor Khasyatillah](mailto:[email protected]), [OCTronics](mailto:[email protected]), [Patrick Chieppe](mailto:[email protected]), [Will Nelson](mailto:[email protected]), [Xander Rudelis](mailto:[email protected]), [e-matteson](mailto:[email protected]), and [kmkzt](mailto:[email protected]) | Apache-2.0 or MIT |
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.13.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [svg](https://github.com/bodoni/svg) | 0.15.1 | [Adam Bryant](mailto:[email protected]), [Felix Schütt](mailto:[email protected]), [Felix Zwettler](mailto:[email protected]), [GeoffreyY](mailto:[email protected]), [Gijs Burghoorn](mailto:[email protected]), [Ivan Ukhov](mailto:[email protected]), [Jack Greenbaum](mailto:[email protected]), [Mike Wilkerson](mailto:[email protected]), [Nathan Hüsken](mailto:[email protected]), [Nathaniel Cook](mailto:[email protected]), [Nick Angelou](mailto:[email protected]), [Nicolas Silva](mailto:[email protected]), [Nor Khasyatillah](mailto:[email protected]), [OCTronics](mailto:[email protected]), [Patrick Chieppe](mailto:[email protected]), [Will Nelson](mailto:[email protected]), [Xander Rudelis](mailto:[email protected]), [e-matteson](mailto:[email protected]), and [kmkzt](mailto:[email protected]) | Apache-2.0 or MIT |
| [tempfile](https://github.com/Stebalien/tempfile) | 3.10.0 | [Steven Allen](mailto:[email protected]), The Rust Project Developers, [Ashley Mannix](mailto:[email protected]), and [Jason White](mailto:[email protected]) | Apache-2.0 or MIT |
| [write_atomic](https://github.com/Blobfolio/write_atomic) | 0.5.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [zerocopy](https://github.com/google/zerocopy) | 0.7.32 | [Joshua Liebow-Feeser](mailto:[email protected]) | Apache-2.0, BSD-2-Clause, or MIT |
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[package]
name = "yesvgmap"
version = "0.5.2"
version = "0.5.3"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
rust-version = "1.73"
description = "Generate SVG sprite maps from individual SVG images."
repository = "https://github.com/Blobfolio/yesvgmap"
readme = "README.md"
Expand Down Expand Up @@ -83,13 +82,14 @@ label = "<PATH(s)…>"
description = "One or more file and/or directory paths to crunch and/or (recursively) crawl. Only files with the extension .svg will ultimately be included."

[build-dependencies]
dowser = "0.8.*"
dowser = "0.9.*"

[dependencies]
argyle = "0.7.*"
dowser = "0.8.*"
fyi_msg = "0.12.*"
svg = "=0.15.0"
dactyl = "0.7.*"
dowser = "0.9.*"
fyi_msg = "0.13.*"
svg = "=0.15.1"
write_atomic = "0.5.*"

[profile.release]
Expand Down
4 changes: 2 additions & 2 deletions release/man/yesvgmap.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "YESVGMAP" "1" "February 2024" "Yesvgmap v0.5.2" "User Commands"
.TH "YESVGMAP" "1" "February 2024" "Yesvgmap v0.5.3" "User Commands"
.SH NAME
Yesvgmap \- Manual page for yesvgmap v0.5.2.
Yesvgmap \- Manual page for yesvgmap v0.5.3.
.SH DESCRIPTION
Generate SVG sprite maps from individual SVG images.
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(super) enum SvgError {
Argue(ArgyleError),

/// # Duplicate entry.
Duplicate,
Duplicate(String),

/// # No SVGs.
NoSvgs,
Expand All @@ -41,6 +41,7 @@ impl Error for SvgError {}
impl fmt::Display for SvgError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Duplicate(s) => write!(f, "Normalized name collision: {s}."),
Self::Parse(p) => write!(f, "Unable to parse: {p:?}."),
Self::Read(p) => write!(f, "Unreadable: {p:?}."),
Self::Viewbox(p) => write!(f, "Missing viewBox: {p:?}"),
Expand All @@ -59,7 +60,6 @@ impl SvgError {
pub(super) const fn as_str(&self) -> &'static str {
match self {
Self::Argue(e) => e.as_str(),
Self::Duplicate => "Normalized file names must be unique.",
Self::NoSvgs => "No SVGs were found.",
Self::Write => "Unable to save the SVG map.",
_ => "",
Expand Down
33 changes: 13 additions & 20 deletions src/img.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use crate::SvgError;
use fyi_msg::Msg;
use std::{
collections::BTreeMap,
fmt,
path::{
Path,
Expand Down Expand Up @@ -77,7 +78,6 @@ impl fmt::Display for Map {
impl Map {
/// # New.
pub(super) fn new(
quiet: bool,
id: Option<&str>,
class: Option<&str>,
hide: HideType,
Expand Down Expand Up @@ -114,7 +114,7 @@ impl Map {
// Handle the paths!
let mut warned: Vec<String> = Vec::new();
let len: usize = paths.len();
let mut nice_paths: Vec<(String, Symbol)> = Vec::with_capacity(len);
let mut nice_paths: BTreeMap<String, Symbol> = BTreeMap::default();
for path in paths {
// The symbol ID is built from the alphanumeric (and dash)
// characters in the file name.
Expand All @@ -129,36 +129,29 @@ impl Map {
let (s, warn) = parse_as_symbol(&path, &stem, prefix)?;

// Push it to temporary storage.
nice_paths.push((stem, s));
if nice_paths.insert(stem.clone(), s).is_some() {
return Err(SvgError::Duplicate(stem));
}

// Note if this has styles or other issues.
if warn && ! quiet {
if warn {
warned.push(path.file_name().unwrap().to_string_lossy().into_owned());
}
}

// Sort and dedup by stem.
nice_paths.sort_by(|a, b| a.0.cmp(&b.0));
nice_paths.dedup_by(|a, b| a.0 == b.0);

// If the length changed, there are duplicates.
if nice_paths.len() != len {
return Err(SvgError::Duplicate);
}

// Mention any potential style/class issues.
if ! warned.is_empty() {
Msg::warning("The following SVG(s) contain scripts, styles, classes, and/or IDs that might
not work correctly when embedded in a sprite map. If you experience issues,
remove those elements from the source(s), then regenerate the map.")
.print();
Msg::warning(format!(
"Scripts, styles, classes, and IDs may not work correctly in sprite map
contexts; the following image{} might need to be refactored:",
if len == 1 { "" } else { "s" },
))
.eprint();

warned.sort();
for w in warned {
println!(" \x1b[1;95m\x1b[0m {w}");
eprintln!(" \x1b[1;93m\x1b[0m {w}");
}

println!();
}

// Done!
Expand Down
17 changes: 12 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use argyle::{
FLAG_REQUIRED,
FLAG_VERSION,
};
use dactyl::traits::NiceInflection;
use dowser::{
Dowser,
Extension,
Expand Down Expand Up @@ -109,7 +110,6 @@ fn _main() -> Result<(), SvgError> {

// Find the files!
let map = Map::new(
out.is_none(), // Don't print warnings if we're using STDOUT.
id,
class,
hide,
Expand All @@ -125,13 +125,20 @@ fn _main() -> Result<(), SvgError> {
.map_err(|_| SvgError::Write)?;

Msg::success(format!(
"A sprite with {} images has been saved to {:?}",
map.len(),
"A sprite with {} has been saved to {:?}",
map.len().nice_inflect("image", "images"),
std::fs::canonicalize(&path).unwrap()
)).print();
)).eprint();
}
// Just print it.
else { println!("{map}"); }
else {
Msg::success(format!(
"Generated a sprite with {}.",
map.len().nice_inflect("image", "images"),
)).eprint();

println!("{map}");
}

// Done!
Ok(())
Expand Down

0 comments on commit 7a30d14

Please sign in to comment.