Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: Missing superscript digits and all subscript digits #70

Merged
merged 2 commits into from
Jul 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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