0.1.1: ignore if first letter is non-alphabetic

This commit is contained in:
Jonathan Flueren 2023-07-07 11:58:20 +02:00
parent e6de23992f
commit 4be4032055
2 changed files with 10 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "schmfy" name = "schmfy"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Schmfication library" description = "Schmfication library"

View file

@ -4,6 +4,15 @@ pub fn schmfy(source: String) -> String {
return source; return source;
} }
if source.len() == 0 {
return source;
}
// can't be empty
if !source.chars().next().unwrap().is_alphabetic() {
return source;
}
// if source is subsite (e.g. news/fsr), schmfy all parts separately // if source is subsite (e.g. news/fsr), schmfy all parts separately
if source.contains('/') { if source.contains('/') {
return source return source