convert names to slugified url strings (NOTE . and _ are preserved)
963794
function unslugify(s) {
  return _.trim(_.map(str(slugify(s)).split('-'), cap1).join(' ')) || s;
}
483485
def prune_urls(url_set, start_url, allowed_list, ignored_list):
    """"""
    result = set()

    for url in url_set:
        allowed = False
        for allow_url in allowed_list:
            if url.startswith(allow_url):
                allowed = True
                break

        if not allowed:
            continue

        ignored = False
        for ignore_url in ignored_list:
            if url.startswith(ignore_url):
                ignored = True
                break

        if ignored:
            continue

        prefix, suffix = (url.rsplit('.', 1) + [''])[:2]
        if suffix.lower() in IGNORE_SUFFIXES:
            continue

        result.add(url)

    return result
1092434
def slugify_filename(filename):
    
    name, ext = os.path.splitext(filename)
    slugified = get_slugified_name(name)
    return slugified + ext
491487
def slug(text, separator="_", permitted_chars=SLUG_CHARS):
    

    text = six.text_type(text or "")

    # Strip non-ASCII characters
    # Example: u' ÁLVARO  justen% ' -> ' ALVARO  justen% '
    text = normalize("NFKD", text.strip()).encode("ascii", "ignore").decode("ascii")

    # Replace word boundaries with separator
    text = REGEXP_WORD_BOUNDARY.sub("\\1" + re.escape(separator), text)

    # Remove non-permitted characters and put everything to lowercase
    # Example: u'_ALVARO__justen%_' -> u'_alvaro__justen_'
    allowed_chars = list(permitted_chars) + [separator]
    text = "".join(char for char in text if char in allowed_chars).lower()

    # Remove double occurrencies of separator
    # Example: u'_alvaro__justen_' -> u'_alvaro_justen_'
    text = (
        REGEXP_SEPARATOR
        if separator == "_"
        else re.compile("(" + re.escape(separator) + "+)")
    ).sub(separator, text)

    # Strip separators
    # Example: u'_alvaro_justen_' -> u'alvaro_justen'
    return text.strip(separator)
972928
function slugifyText(str) {
        str = str.replace(/^\s+|\s+$/g, '') // trim
        .toLowerCase().replace(/\./g, '-') // Replace a dot for a -
        .replace(/\*/g, '-') // Replace a * for a -
        .replace(/\+/g, '-'); // Replace a + for a -

        // Remove accents, swap ñ for n, etc
        var from = 'àáäâãèéëêìíïîòóöôõùúüûýÿñç·/_,:;';
        var to = 'aaaaaeeeeiiiiooooouuuuyync------';

        for (var i = 0, len = from.length; i < len; i += 1) {
            str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
        }

        str = str.replace(/[^a-z0-9 -]/g, '') // Remove invalid chars
        .replace(/\s+/g, '-') // Collapse whitespace and replace by -
        .replace(/-+/g, '-'); // Collapse dashes

        if (str.charAt(0) === '-') str = str.substr(1);
        if (str.charAt(str.length - 1) === '-') str = str.substr(0, str.length - 1);

        return str;
    }
1251121
function convertFieldName (name) {
  const regex = new RegExp(/\.|\(|\)/g)
  return name.replace(regex, '').replace(/\s/g, '_')
}
1214938
def _slugify(text, delim=u'-'):
    """"""
    result = []
    for word in _punct_re.split(text.lower()):
        word = word.encode('utf-8')
        if word:
            result.append(word)
    slugified = delim.join([i.decode('utf-8') for i in result])
    return re.sub('[^a-zA-Z0-9\\s\\-]{1}', replace_char, slugified).lower()
1004488
def slugify(value):
    ''''
    
    '''
    value = re.sub(r'[^\w\s-]', '', value).strip().lower()
    return re.sub(r'[-\s]+', '-', value)
381148
def full_clean(self, *args, **kwargs):
        
        name = getattr(self, 'name', self.slugName.title())
        self.title = "{} for {}".format(name, dateFormat(self.except_date))
        self.slug = "{}-{}".format(self.except_date, self.slugName)
        super().full_clean(*args, **kwargs)
348857
def slugify(value):
    
    value = re.sub(r"[^\w\s-]", "", value).strip()
    return re.sub(r"[-\s]+", "-", value)
361677
function slugify()
    {
        $text = (string) $this;

        // replace non letter or digits by -
        $text = preg_replace('~[^\pL\d]+~u', '-', $text);

        // transliterate
        $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);

        // remove unwanted characters
        $text = preg_replace('~[^-\w]+~', '', $text);

        // trim
        $text = trim($text, '-');

        // remove duplicate -
        $text = preg_replace('~-+~', '-', $text);

        // lowercase
        $text = strtolower($text);

        if (empty($text))
            return 'n-a';

        return new self($text);
    }
1271976
def wikipedia_slugify(value, do_unidecode=False):
    
    if do_unidecode:
        value = unidecode(value)
    value = value.strip()
    return mark_safe(re.sub('[\s/#\?:@]+', '_', value))
681137
function sluggifyText (text) {
  const slug = unEscapeHtmlTags(text).toLowerCase()
    // Replace 'unsafe' chars with dashes (!!!! is changed to -)
    .replace(unsafeCharsRegex, '-')
    // Replace multiple concurrent dashes with a single dash
    .replace(multiDashRegex, '-')
    // Remove trailing -
    .replace(lastCharDashRegex, '')
  // Encode the resulting string to make it url-safe
  return encodeURIComponent(slug)
}
596105
def slugify(in_string):
    
    try:
        u_in_string = six.text_type(in_string).lower()
    except UnicodeDecodeError:
        raise ValueError("We expects when in_string is str type," + \
                         "it is an ascii, but now it isn't. Use unicode " + \
                         "in this case.")
    # convert & to "and"
    u_in_string = re.sub('\&amp\;|\&', ' and ', u_in_string)
    # replace spaces by hyphen
    u_in_string = re.sub('[-\s]+', '-', u_in_string)
    # remove symbols that not in alphabet
    u_in_string = u''.join([symb for symb in u_in_string if symb in ALPHABET])
    # translify it
    out_string = translify(u_in_string)
    # remove non-alpha
    return re.sub('[^\w\s-]', '', out_string).strip().lower()
66642
def automatic_slug_renaming(slug, is_slug_safe):
    """"""

    if not isinstance(is_slug_safe, collections.Callable):
        raise TypeError('is_slug_safe must be callable')

    if is_slug_safe(slug):
       return slug

    count = 2
    new_slug = slug + "-" + str(count)
    while not is_slug_safe(new_slug):
        count = count + 1
        new_slug = slug + "-" + str(count)
    return new_slug
523090
def slugify(text, delim='-'):
    """"""
    punctuation_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.:]+')

    result = []
    for word in punctuation_re.split(text.lower()):
        word = normalize_text(word)
        if word:
            result.append(word)
    return delim.join(result)
95680
def sanitized_name(self):
        
        a = re.split("[:/]", self.name)
        return "_".join([i for i in a if len(i) > 0])