JavaScript URLify vs. Python slugify

Showing 1-2 of 2 messages
JavaScript URLify vs. Python slugify Mitar 6/10/11 12:35 AM

I was curious how slugify and urlify work and how they relate to each
other (I thought that urlify in fact calls over Ajax slugify) and then
I discovered that they are quite different. Then I went and read some
tickets about it and came about this conclusion:

This was strange for me because some time ago I have made a JavaScript
function which behaves exactly as main part of slugify (not knowing
that there is urlify JavaScript with Django): normalizing Unicode and
striping accents. So I think that there is a better way than
"continuing to tweak urlify.js is not an option, it will become
ridiculously large and unmanageable."

I just want to point out that there is another approach. Maybe it
could be included in the Django core, for compatibility sake named
slugify also in JavaScript, and allowing developers to choose which
one they want for their slug fields. I know that this means reopening
a long discussion from the past, but I think it is worth it as having
both JavaScript and Python code behave the same, if wanted, would be
great. Or we could also combine urlify (and its information about
direct mapping between characters in various languages) and slugify
(with its Unicode approach), both in JavaScript and Python.

I am attaching an example code how to do that In JavaScript.


Re: JavaScript URLify vs. Python slugify Mitar 6/11/11 2:14 AM

Ups, sorry, that was meant for django-developers mailing list. This
auto completion ...