diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-10 18:57:08 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 18:57:08 +0000 |
commit | b16e7a6081b5864023c1501f150c2e019db4702f (patch) | |
tree | 93f5eef58204877303b4b52c12e2e1844f6271e5 /python-unicode-slugify.spec | |
parent | 41b8ebf3d6340c190ef530c9a103116cc136ff23 (diff) |
automatic import of python-unicode-slugify
Diffstat (limited to 'python-unicode-slugify.spec')
-rw-r--r-- | python-unicode-slugify.spec | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/python-unicode-slugify.spec b/python-unicode-slugify.spec new file mode 100644 index 0000000..7fc5426 --- /dev/null +++ b/python-unicode-slugify.spec @@ -0,0 +1,218 @@ +%global _empty_manifest_terminate_build 0 +Name: python-unicode-slugify +Version: 0.1.5 +Release: 1 +Summary: A slug generator that turns strings into unicode slugs. +License: BSD +URL: http://github.com/mozilla/unicode-slugify +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ed/37/c82a28893c7bfd881c011cbebf777d2a61f129409d83775f835f70e02c20/unicode-slugify-0.1.5.tar.gz +BuildArch: noarch + +Requires: python3-six +Requires: python3-unidecode + +%description +# Unicode Slugify + +Unicode Slugify is a slugifier that generates unicode slugs. It was originally +used in the Firefox Add-ons web site to generate slugs for add-ons and add-on +collections. Many of these add-ons and collections had unicode characters and +required more than simple transliteration. + +## Usage + +```python + +from slugify import slugify, SLUG_OK + +# Default usage : lower, spaces replaced with "-", only alphanum and "-_~" chars, keeps unicode +slugify(u'Bän...g (bang)') +# u'bäng-bang' + +# Keep capital letters and spaces +slugify(u'Bän...g (bang)', lower=False, spaces=True) +# u'Bäng bang' + +# Replace non ascii chars with their "best" representation +slugify(u'北京 (capital of China)', only_ascii=True) +# u'bei-jing-capital-of-china' + +# Allow some extra chars +slugify(u'北京 (capital of China)', ok=SLUG_OK+'()', only_ascii=True) +# u'bei-jing-(capital-of-china)' + +# "snake_case" example +def snake_case(s): + # As "-" is not in allowed Chars, first one (`_`) is used for space replacement + return slugify(s, ok='_', only_ascii=True) +snake_case(u'北京 (capital of china)') +# u'bei_jing_capital_of_china' + +# "CamelCase" example +def camel_case(s): + return slugify(s.title(), ok='', only_ascii=True, lower=False) +camel_case(u'北京 (capital of china)') +# u'BeiJingCapitalOfChina' +``` + +## Thanks + +Tomaz Solc, unidecode, https://pypi.python.org/pypi/Unidecode + + + + +%package -n python3-unicode-slugify +Summary: A slug generator that turns strings into unicode slugs. +Provides: python-unicode-slugify +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-unicode-slugify +# Unicode Slugify + +Unicode Slugify is a slugifier that generates unicode slugs. It was originally +used in the Firefox Add-ons web site to generate slugs for add-ons and add-on +collections. Many of these add-ons and collections had unicode characters and +required more than simple transliteration. + +## Usage + +```python + +from slugify import slugify, SLUG_OK + +# Default usage : lower, spaces replaced with "-", only alphanum and "-_~" chars, keeps unicode +slugify(u'Bän...g (bang)') +# u'bäng-bang' + +# Keep capital letters and spaces +slugify(u'Bän...g (bang)', lower=False, spaces=True) +# u'Bäng bang' + +# Replace non ascii chars with their "best" representation +slugify(u'北京 (capital of China)', only_ascii=True) +# u'bei-jing-capital-of-china' + +# Allow some extra chars +slugify(u'北京 (capital of China)', ok=SLUG_OK+'()', only_ascii=True) +# u'bei-jing-(capital-of-china)' + +# "snake_case" example +def snake_case(s): + # As "-" is not in allowed Chars, first one (`_`) is used for space replacement + return slugify(s, ok='_', only_ascii=True) +snake_case(u'北京 (capital of china)') +# u'bei_jing_capital_of_china' + +# "CamelCase" example +def camel_case(s): + return slugify(s.title(), ok='', only_ascii=True, lower=False) +camel_case(u'北京 (capital of china)') +# u'BeiJingCapitalOfChina' +``` + +## Thanks + +Tomaz Solc, unidecode, https://pypi.python.org/pypi/Unidecode + + + + +%package help +Summary: Development documents and examples for unicode-slugify +Provides: python3-unicode-slugify-doc +%description help +# Unicode Slugify + +Unicode Slugify is a slugifier that generates unicode slugs. It was originally +used in the Firefox Add-ons web site to generate slugs for add-ons and add-on +collections. Many of these add-ons and collections had unicode characters and +required more than simple transliteration. + +## Usage + +```python + +from slugify import slugify, SLUG_OK + +# Default usage : lower, spaces replaced with "-", only alphanum and "-_~" chars, keeps unicode +slugify(u'Bän...g (bang)') +# u'bäng-bang' + +# Keep capital letters and spaces +slugify(u'Bän...g (bang)', lower=False, spaces=True) +# u'Bäng bang' + +# Replace non ascii chars with their "best" representation +slugify(u'北京 (capital of China)', only_ascii=True) +# u'bei-jing-capital-of-china' + +# Allow some extra chars +slugify(u'北京 (capital of China)', ok=SLUG_OK+'()', only_ascii=True) +# u'bei-jing-(capital-of-china)' + +# "snake_case" example +def snake_case(s): + # As "-" is not in allowed Chars, first one (`_`) is used for space replacement + return slugify(s, ok='_', only_ascii=True) +snake_case(u'北京 (capital of china)') +# u'bei_jing_capital_of_china' + +# "CamelCase" example +def camel_case(s): + return slugify(s.title(), ok='', only_ascii=True, lower=False) +camel_case(u'北京 (capital of china)') +# u'BeiJingCapitalOfChina' +``` + +## Thanks + +Tomaz Solc, unidecode, https://pypi.python.org/pypi/Unidecode + + + + +%prep +%autosetup -n unicode-slugify-0.1.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-unicode-slugify -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.5-1 +- Package Spec generated |