Skip to content

String to slug function optimized for prettier URLs. Help wanted for converting non-alphanumeric characters into URL friendly words when logical.

License

Notifications You must be signed in to change notification settings

crab-cr/webslug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webslug

inspired by "slug" from npm, but optimized for my slugs use case. Requests for more slug examples are welcome!

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      webslug:
        github: iomcr/webslug
  2. Run shards install

Usage

require "webslug"

Iom::WebSlug.slug("i ♥ unicode").should eq "i-love-unicode"
Iom::WebSlug.slug("I ♥ UNICODE").should eq "i-love-unicode"
Iom::WebSlug.slug("i <3 unicode").should eq "i-love-unicode"
Iom::WebSlug.slug("компютъра").should eq "kompyutura"
Iom::WebSlug.slug("unicode ♥ is ☢").should eq "unicode-love-is-radioactive"
Iom::WebSlug.slug("http://www.example.com").should eq "www-example-com"
Iom::WebSlug.slug("Schlotsky's").should eq "schlotskys"

Development

TODO: Write development instructions here

Contributing

  1. Fork it (https://github.com/iomcr/webslug/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Iomcr - creator and maintainer

About

String to slug function optimized for prettier URLs. Help wanted for converting non-alphanumeric characters into URL friendly words when logical.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published