Python .parameterize equivalente a Rails .parameterize
import reimport unicodedatadef parameterize(string_to_clean, sep = ‘-‘): parameterized_string = unicodedata.normalize(‘NFKD’, string_to_clean).encode(‘ASCII’, ‘ignore’).decode() parameterized_string = re.sub(“[^a-zA-Z0-9-_]+”, sep, parameterized_string) if sep is not None and sep is not ”: parameterized_string = re.sub(‘/#{re_sep}{2,}’, …
Continuar lendo