Skip to content

Simple library to provide Wikidot-compatible string normalization.

License

Notifications You must be signed in to change notification settings

scpwiki/wikidot-normalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wikidot-normalize

Rust CI badge docs.rs link

Simple library to provide Wikidot-compatible string normalization. It is a Rust port of the functionality in WDStringUtils::toUnixName.

Wikidot normal form is used in the site's page names. Essentially it ensures the following:

  • All ASCII is lowercase.
  • All characters outside of :, a-z, 0-9, or - are replaced with dashes.
  • Underscores are only permitted as the first character.
  • Any leading or trailing dashes are removed.
  • Any set of multiple dashes are replaced with a single dash.
  • Any set of multiple colons are replaced with a single colon.

Examples:

  • "Big Cheese Horace" -> "big-cheese-horace"
  • "bottom--Text" -> "bottom-text"
  • "Tufto's Proposal" -> "tufto-s-proposal"
  • "-test-" -> "test"

This library is getting close to finalization with a v1.0.0 release.

Available under the terms of the MIT License. See LICENSE.md.

Compilation

This library targets the latest stable Rust. At time of writing, that is 1.68.2

$ cargo build --release

Testing

$ cargo test

Add -- --nocapture to the end if you want to see test output.

About

Simple library to provide Wikidot-compatible string normalization.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages