Skip to content

Commit

Permalink
Merge pull request #70 from BlueM/master
Browse files Browse the repository at this point in the history
Add missing superscript digits and all subscript digits
  • Loading branch information
Florian Eckerstorfer committed Jul 10, 2015
2 parents 5d8e48f + 02359d3 commit 64360a0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $slugify->activateRuleset('esperanto');
echo $slugify->slugify('serĉi manĝi'); // sercxi-mangxi
```

You can add rulesets by using `Slugify::addRuleset()` and retrieve all rulesets with `Slugify::getRuleset()`.
You can add rulesets by using `Slugify::addRuleset()` and retrieve all rulesets with `Slugify::getRulesets()`.

### Further Customization

Expand Down
21 changes: 19 additions & 2 deletions src/Slugify.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,30 @@ class Slugify implements SlugifyInterface

/** @var array */
protected $rules = array(
// Numeric characters
// Numeric characters, superscript
'°' => 0,
'¹' => 1,
'²' => 2,
'³' => 3,
'' => 4,
'' => 5,
'' => 6,
'' => 7,
'' => 8,
'' => 9,
// Numeric characters, subscript
'' => 0,
'' => 1,
'' => 2,
'' => 3,
'' => 4,
'' => 5,
'' => 6,
'' => 7,
'' => 8,
'' => 9,

// Latin
'°' => 0,
'æ' => 'ae',
'ǽ' => 'ae',
'À' => 'A',
Expand Down
2 changes: 1 addition & 1 deletion tests/SlugifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function provider()
array('Á À á à É È é è Ó Ò ó ò Ñ ñ Ú Ù ú ù', 'a-a-a-a-e-e-e-e-o-o-o-o-n-n-u-u-u-u'),
array('Â â Ê ê Ô ô Û û', 'a-a-e-e-o-o-u-u'),
array('Â â Ê ê Ô ô Û 1', 'a-a-e-e-o-o-u-1'),
array('°¹²³@', '0123at'),
array('°¹²³⁴⁵⁶⁷⁸⁹@₀₁₂₃₄₅₆₇₈₉', '0123456789at0123456789'),
array('Mórë thån wørds', 'more-than-words'),
array('Блоґ їжачка', 'blog-jizhachka'),
array('фильм', 'film'),
Expand Down

0 comments on commit 64360a0

Please sign in to comment.