Generate a slug for the knowledge.

        :param name: text to slugify
        :return: slugified text
428893
def generate_slug(name):
        
        slug = slugify(name)

        i = KnwKB.query.filter(db.or_(
            KnwKB.slug.like(slug),
            KnwKB.slug.like(slug + '-%'),
        )).count()

        return slug + ('-{0}'.format(i) if i > 0 else '')
335994
public static function identifier(string $name, string $separator = '_'): string {
    $slugify    = new Slugify(['separator' => $separator]);
    $identifier = $slugify->slugify($name);

    return $identifier;
  }
93281
private function generateContentAlias($name)
    {
        $alias = $name;
        while ($this->hasContent($alias)) {
            $alias = uniqid($name . '_');
        }

        return $alias;
    }
1239564
def generate_id(*s):
    
    with translation.override("en"):
        generated_id = slugify("-".join([str(i) for i in s]))
    return generated_id
496744
function slugToTitle (slug) {
  slug = slug.replace('.md', '').trim();
  return _s.titleize(_s.humanize(path.basename(slug)));
}
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)
}
635416
def slugify(self, value):
        
        value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
        value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
        return re.sub('[-\s]+', '-', value)
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)
477719
def generate_feature(self, name, policy='require'):
        

        return ET.Element('feature', policy=policy, name=name)
596489
def derive_and_set_name_fields_and_slug(
            self, set_name_sort=True, set_slug=True
    ):
        
        # name_full is the primary required name field. It must be set.
        if is_empty(self.name_full):
            if not is_empty(self.name_display):
                self.name_full = self.name_display
            else:
                raise ValueError(
                    u"%s.name_full cannot be empty at save" % type(self).__name__)
        # if empty, `name_sort` == `name_full`
        if set_name_sort and is_empty(self.name_sort):
            self.name_sort = self.derive_sort_name()
        # if empty, `slug` is set to slugified `name_full`
        if set_slug and is_empty(self.slug):
            self.slug = slugify(self.name_display or self.name_full)
1292190
def _generate_slug(self, value):
        
        alphabet = app_settings.SLUG_ALPHABET
        salt = app_settings.SLUG_SALT

        hashids = Hashids(alphabet=alphabet, salt=salt, min_length=5)

        return hashids.encode(value)
805990
def llen(self, name):
        
        with self.pipe as pipe:
            return pipe.llen(self.redis_key(name))
665053
def slugify(self, value):
        '''
        
        '''
        if value is None:
            return

        return slugify.slugify(value, max_length=self.max_length,
                               separator=self.separator,
                               to_lower=self.lower_case)
996531
def slugify(value, hyphenate=True, lower=True):
    
    import unicodedata
    value = unicodedata.normalize('NFKD', value).strip()
    replacement = '-' if hyphenate else ''
    if lower: value = value.lower()
    return _CHANGEME_RE.sub(replacement, value)
1273757
def derive_and_set_name_fields_and_slug(
        self, set_name_sort=True, set_slug=True
    ):
        
        super(PersonCreator, self).derive_and_set_name_fields_and_slug(
            set_name_sort=False, set_slug=False)
        # Collect person name fields, but only if they are not empty
        person_names = [
            name for name in [self.name_family, self.name_given]
            if not is_empty(name)
        ]
        # if empty, set `name_sort` = '{name_family}, {name_given}' if these
        # person name values are available otherwise `name_full`
        if set_name_sort and is_empty(self.name_sort):
            if person_names:
                self.name_sort = ', '.join(person_names)
            else:
                self.name_sort = self.name_full
        # if empty, set `slug` to slugified '{name_family} {name_given}' if
        # these person name values are available otherwise slugified
        # `name_full`
        if set_slug and is_empty(self.slug):
            if person_names:
                self.slug = slugify(' '.join(person_names))
            else:
                self.slug = slugify(self.name_full)
335575
def setName( self, name ):
        
        self._name = projex.text.nativestring(name)
        self.setText(0, ' '.join(projex.text.words(self._name)))
90816
def column_alias(cell, names):
    
    column = slugify(cell.column or '', sep='_')
    column = column.strip('_')
    column = 'column' if not len(column) else column
    name, i = column, 2
    # de-dupe: column, column_2, column_3, ...
    while name in names:
        name = '%s_%s' % (name, i)
        i += 1
    return name