Skip to content

Commit 5dfe43c

Browse files
committed
added slufigy() and is_slug()
1 parent 5d7468a commit 5dfe43c

17 files changed

+222
-39
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Python String Utils Changelog
22

3+
## v0.6.0
4+
5+
### Added:
6+
7+
- slugify
8+
- is_slug
9+
310
## v0.5.0
411

512
### Added:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ A small utility library to check and manipulate strings.
2828
- is_pangram
2929
- is_palindrome
3030
- is_isogram
31+
- is_slug
3132
- words_count
3233
- contains_html
3334

@@ -40,6 +41,7 @@ A small utility library to check and manipulate strings.
4041
- shuffle
4142
- strip_html
4243
- prettify
44+
- slugify
4345

4446

4547
...and more are coming!
122 Bytes
Binary file not shown.

docs/_build/doctrees/index.doctree

5.83 KB
Binary file not shown.

docs/_build/html/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: a207946dbf2ca7a53a400cd856a07176
3+
config: 795fda3a4963648736253334baf00dc7
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/_build/html/_sources/index.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55

6-
Welcome to Python String Utils's documentation!
7-
===============================================
6+
string_utils documentation
7+
==========================
88

99
Contents:
1010

docs/_build/html/genindex.html

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1111

12-
<title>Index &mdash; Python String Utils 0.5.0 documentation</title>
12+
<title>Index &mdash; Python String Utils 0.6.0 documentation</title>
1313

1414

1515

@@ -34,7 +34,7 @@
3434
<link rel="index" title="Index"
3535
href="#"/>
3636
<link rel="search" title="Search" href="search.html"/>
37-
<link rel="top" title="Python String Utils 0.5.0 documentation" href="index.html"/>
37+
<link rel="top" title="Python String Utils 0.6.0 documentation" href="index.html"/>
3838

3939

4040
<script src="_static/js/modernizr.min.js"></script>
@@ -62,7 +62,7 @@
6262

6363

6464
<div class="version">
65-
0.5.0
65+
0.6.0
6666
</div>
6767

6868

@@ -181,12 +181,12 @@ <h2 id="I">I</h2>
181181
<dt><a href="index.html#string_utils.is_isogram">is_isogram() (in module string_utils)</a>
182182
</dt>
183183

184-
</dl></td>
185-
<td style="width: 33%" valign="top"><dl>
186184

187185
<dt><a href="index.html#string_utils.is_json">is_json() (in module string_utils)</a>
188186
</dt>
189187

188+
</dl></td>
189+
<td style="width: 33%" valign="top"><dl>
190190

191191
<dt><a href="index.html#string_utils.is_palindrome">is_palindrome() (in module string_utils)</a>
192192
</dt>
@@ -196,6 +196,10 @@ <h2 id="I">I</h2>
196196
</dt>
197197

198198

199+
<dt><a href="index.html#string_utils.is_slug">is_slug() (in module string_utils)</a>
200+
</dt>
201+
202+
199203
<dt><a href="index.html#string_utils.is_snake_case">is_snake_case() (in module string_utils)</a>
200204
</dt>
201205

@@ -242,12 +246,16 @@ <h2 id="S">S</h2>
242246
</dt>
243247

244248

245-
<dt><a href="index.html#string_utils.snake_case_to_camel">snake_case_to_camel() (in module string_utils)</a>
249+
<dt><a href="index.html#string_utils.slugify">slugify() (in module string_utils)</a>
246250
</dt>
247251

248252
</dl></td>
249253
<td style="width: 33%" valign="top"><dl>
250254

255+
<dt><a href="index.html#string_utils.snake_case_to_camel">snake_case_to_camel() (in module string_utils)</a>
256+
</dt>
257+
258+
251259
<dt><a href="index.html#module-string_utils">string_utils (module)</a>
252260
</dt>
253261

@@ -311,7 +319,7 @@ <h2 id="W">W</h2>
311319
<script type="text/javascript">
312320
var DOCUMENTATION_OPTIONS = {
313321
URL_ROOT:'./',
314-
VERSION:'0.5.0',
322+
VERSION:'0.6.0',
315323
COLLAPSE_INDEX:false,
316324
FILE_SUFFIX:'.html',
317325
HAS_SOURCE: true

docs/_build/html/index.html

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1010

11-
<title>Welcome to Python String Utils’s documentation! &mdash; Python String Utils 0.5.0 documentation</title>
11+
<title>string_utils documentation &mdash; Python String Utils 0.6.0 documentation</title>
1212

1313

1414

@@ -33,7 +33,7 @@
3333
<link rel="index" title="Index"
3434
href="genindex.html"/>
3535
<link rel="search" title="Search" href="search.html"/>
36-
<link rel="top" title="Python String Utils 0.5.0 documentation" href="#"/>
36+
<link rel="top" title="Python String Utils 0.6.0 documentation" href="#"/>
3737

3838

3939
<script src="_static/js/modernizr.min.js"></script>
@@ -61,7 +61,7 @@
6161

6262

6363
<div class="version">
64-
0.5.0
64+
0.6.0
6565
</div>
6666

6767

@@ -84,7 +84,7 @@
8484

8585
<!-- Local TOC -->
8686
<div class="local-toc"><ul>
87-
<li><a class="reference internal" href="#">Welcome to Python String Utils&#8217;s documentation!</a></li>
87+
<li><a class="reference internal" href="#">string_utils documentation</a></li>
8888
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
8989
</ul>
9090
</div>
@@ -116,7 +116,7 @@
116116
<ul class="wy-breadcrumbs">
117117
<li><a href="#">Docs</a> &raquo;</li>
118118

119-
<li>Welcome to Python String Utils&#8217;s documentation!</li>
119+
<li>string_utils documentation</li>
120120
<li class="wy-breadcrumbs-aside">
121121

122122

@@ -130,8 +130,8 @@
130130
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
131131
<div itemprop="articleBody">
132132

133-
<div class="section" id="welcome-to-python-string-utils-s-documentation">
134-
<h1>Welcome to Python String Utils&#8217;s documentation!<a class="headerlink" href="#welcome-to-python-string-utils-s-documentation" title="Permalink to this headline"></a></h1>
133+
<div class="section" id="string-utils-documentation">
134+
<h1>string_utils documentation<a class="headerlink" href="#string-utils-documentation" title="Permalink to this headline"></a></h1>
135135
<p>Contents:</p>
136136
<div class="toctree-wrapper compound">
137137
</div>
@@ -420,6 +420,27 @@ <h1>Welcome to Python String Utils&#8217;s documentation!<a class="headerlink" h
420420
</table>
421421
</dd></dl>
422422

423+
<dl class="function">
424+
<dt id="string_utils.is_slug">
425+
<code class="descclassname">string_utils.</code><code class="descname">is_slug</code><span class="sig-paren">(</span><em>string</em>, <em>sign='-'</em><span class="sig-paren">)</span><a class="headerlink" href="#string_utils.is_slug" title="Permalink to this definition"></a></dt>
426+
<dd><p>Checks if a given string is a slug.</p>
427+
<table class="docutils field-list" frame="void" rules="none">
428+
<col class="field-name" />
429+
<col class="field-body" />
430+
<tbody valign="top">
431+
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
432+
<li><strong>string</strong> (<em>str</em>) &#8211; String to check.</li>
433+
<li><strong>sign</strong> (<em>str</em>) &#8211; Join sign used by the slug.</li>
434+
</ul>
435+
</td>
436+
</tr>
437+
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if slug, false otherwise.</p>
438+
</td>
439+
</tr>
440+
</tbody>
441+
</table>
442+
</dd></dl>
443+
423444
<dl class="function">
424445
<dt id="string_utils.words_count">
425446
<code class="descclassname">string_utils.</code><code class="descname">words_count</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span><a class="headerlink" href="#string_utils.words_count" title="Permalink to this definition"></a></dt>
@@ -596,7 +617,7 @@ <h1>Welcome to Python String Utils&#8217;s documentation!<a class="headerlink" h
596617
<ul class="simple">
597618
<li>String cannot start or end with spaces</li>
598619
<li>String cannot have multiple sequential spaces, empty lines or punctuation (except for &#8221;?&#8221;, &#8221;!&#8221; and &#8221;.&#8221;)</li>
599-
<li>Arithmetic operators (&#8220;+&#8221;, &#8220;-&#8221;, &#8220;/&#8221;, &#8220;*&#8221;, &#8220;=&#8221;) must have one, and only one space before and after themselves</li>
620+
<li>Arithmetic operators (+, -, /, *, =) must have one, and only one space before and after themselves</li>
600621
<li>The first letter after a dot, an exclamation or a question mark must be uppercase</li>
601622
<li>One, and only one space should follow a dot, an exclamation or a question mark</li>
602623
<li>Text inside double quotes cannot start or end with spaces, but one, and only one space must come first and after quotes (foo&#8221; bar&#8221;baz -&gt; foo &#8220;bar&#8221; baz)</li>
@@ -618,6 +639,28 @@ <h1>Welcome to Python String Utils&#8217;s documentation!<a class="headerlink" h
618639
</table>
619640
</dd></dl>
620641

642+
<dl class="function">
643+
<dt id="string_utils.slugify">
644+
<code class="descclassname">string_utils.</code><code class="descname">slugify</code><span class="sig-paren">(</span><em>string</em>, <em>sign='-'</em><span class="sig-paren">)</span><a class="headerlink" href="#string_utils.slugify" title="Permalink to this definition"></a></dt>
645+
<dd><p>Converts a string into a slug using provided join sign.
646+
(<strong>(This Is A &#8220;Test&#8221;!)</strong> -&gt; <strong>this-is-a-test</strong>)</p>
647+
<table class="docutils field-list" frame="void" rules="none">
648+
<col class="field-name" />
649+
<col class="field-body" />
650+
<tbody valign="top">
651+
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
652+
<li><strong>string</strong> (<em>str</em>) &#8211; String to convert.</li>
653+
<li><strong>sign</strong> (<em>str</em>) &#8211; Sign used to join string tokens (default to &#8220;-&#8221;).</li>
654+
</ul>
655+
</td>
656+
</tr>
657+
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Slugified string</p>
658+
</td>
659+
</tr>
660+
</tbody>
661+
</table>
662+
</dd></dl>
663+
621664
</div>
622665
<div class="section" id="indices-and-tables">
623666
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline"></a></h1>
@@ -660,7 +703,7 @@ <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Pe
660703
<script type="text/javascript">
661704
var DOCUMENTATION_OPTIONS = {
662705
URL_ROOT:'./',
663-
VERSION:'0.5.0',
706+
VERSION:'0.6.0',
664707
COLLAPSE_INDEX:false,
665708
FILE_SUFFIX:'.html',
666709
HAS_SOURCE: true

docs/_build/html/objects.inv

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Sphinx inventory version 2
22
# Project: Python String Utils
3-
# Version: 0.5.0
3+
# Version: 0.6.0
44
# The remainder of this file is compressed using zlib.
5-
xڝ��N�0 ��}� �8ub׽�I��1
6-
������$�Ɔ@Hޭ����ql#%�'��Xqٹ��� ������f��D��|3(V
7-
AR����#��2����!���I����Ay��hCL��S��㘭���Md�1LI9�E�"��E��.��魽t�_S/���OL@dƅ�$x�ĺ;�y-��.q�u�8t����e�#$]f6dO�S��"��Ϊ�r�~+N�U'�gw��0Tх��P����/4�@��Mǚ�=��dei�,n�������h�>����#�4�?�fk�C�����0�
5+
xڝ�KN�0 ��=E$�v�l�,��8@��%;z{�F���<���?ۉ]SFfY�u$�z���A�`��d��m��@�I+NjE s��;�S :����7CV6�lngI����hx xe�5N�9ٍ<�&�����7�*���
6+
��\��G�0_m��F�d�B)�3p !g;� ��uwZ�49Q�«joJ[�_ˡ�!q��?#��b �j��Yesq��d<��uӉ��9�2u�ܢ����[ơ.�?�u�:z����{*�z�It[�t���a��"�

docs/_build/html/py-modindex.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1010

11-
<title>Python Module Index &mdash; Python String Utils 0.5.0 documentation</title>
11+
<title>Python Module Index &mdash; Python String Utils 0.6.0 documentation</title>
1212

1313

1414

@@ -33,7 +33,7 @@
3333
<link rel="index" title="Index"
3434
href="genindex.html"/>
3535
<link rel="search" title="Search" href="search.html"/>
36-
<link rel="top" title="Python String Utils 0.5.0 documentation" href="index.html"/>
36+
<link rel="top" title="Python String Utils 0.6.0 documentation" href="index.html"/>
3737

3838

3939
<script type="text/javascript">
@@ -68,7 +68,7 @@
6868

6969

7070
<div class="version">
71-
0.5.0
71+
0.6.0
7272
</div>
7373

7474

@@ -181,7 +181,7 @@ <h1>Python Module Index</h1>
181181
<script type="text/javascript">
182182
var DOCUMENTATION_OPTIONS = {
183183
URL_ROOT:'./',
184-
VERSION:'0.5.0',
184+
VERSION:'0.6.0',
185185
COLLAPSE_INDEX:false,
186186
FILE_SUFFIX:'.html',
187187
HAS_SOURCE: true

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy