public
Description: Convert accented characters to their ASCII equivalents
Homepage: http://github.com/ionfish/urlify
Clone URL: git://github.com/ionfish/urlify.git
urlify /
name age message
file LICENSE Tue Oct 13 01:30:55 -0700 2009 Move license text to a separate LICENSE file. [ionfish]
file README.md Tue Oct 13 01:30:55 -0700 2009 Move license text to a separate LICENSE file. [ionfish]
file Rakefile Fri Oct 09 06:33:42 -0700 2009 Correct homepage link. [ionfish]
file VERSION.yml Fri Oct 09 06:34:31 -0700 2009 Version 0.2.1. [ionfish]
directory lib/ Mon Jul 06 08:57:46 -0700 2009 Supplement the library with additional characte... [ionfish]
directory pkg/ Mon Jun 29 09:56:41 -0700 2009 Update description and add gitignore to pkg dir... [ionfish]
directory test/ Mon Jul 06 08:57:46 -0700 2009 Supplement the library with additional characte... [ionfish]
file urlify.gemspec Tue Oct 13 01:30:55 -0700 2009 Move license text to a separate LICENSE file. [ionfish]
README.md

URLify

A tiny library to convert diacritical marks to unaccented equivalents, for ASCII-safe URI creation. It also includes a utility method to remove subtitles.

Installation

sudo gem install urlify

URLify is available from Gemcutter and in source form on GitHub.

API

URLify.deaccentuate "Kurt Gödel"        # => "Kurt Godel"

URLify.strip_subtitle "Begriffsschrift:
  eine der arithmetischen nachgebildete
  Formelsprache des reinen Denkens"     # => "Begriffsschrift"

URLify.urlify "Über Sinn und Bedeutung" # => "uber_sinn_und_bedeutung"

URLify.urlify "Moses Schönfinkel", "-"  # => "moses-schoenfinkel"

The URLify module may be mixed into the String class to add the above class methods--deaccentuate, strip_subtitle and urlify--as instance methods on the String class. It is not mixed in by default, for obvious reasons.

class String
  include URLify
end

"Grundzüge der theoretischen Logik".urlify
  # => "grundzuge_der_theoretischen_logik"

Please note that non-a-z characters are removed by the deaccentuate and urlify methods, and only characters in URLify's accent library will be replaced by their ASCII counterparts. If the library doesn't include a particular conversion, please consider forking the project and adding it.

Licence

URLify is released under the BSD license. Please see the LICENSE file for details.