-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: use slugify and emoji.json
- Loading branch information
1 parent
51d4471
commit 5eb0199
Showing
10 changed files
with
1,336 additions
and
1,140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
import { helper } from '@ember/component/helper' | ||
import { slugify as slugfyFunction } from 'ember-slugify' | ||
|
||
const AVAILABLE_OPTIONS = [ | ||
'replacement', // options from slugify dependency | ||
'remove', // options from slugify dependency | ||
'lower', // options from slugify dependency | ||
'strict', // options from slugify dependency | ||
'locale', // options from slugify dependency | ||
'trim', // options from slugify dependency | ||
'pinyin', // replace pinyin by latin character (boolean) | ||
'emoji', // replace emoji by english name (boolean) | ||
] | ||
|
||
function slugify(args) { | ||
let [string] = args | ||
return slugfyFunction(string) | ||
let [string, options] = args | ||
let opts = {} | ||
if (options) { | ||
AVAILABLE_OPTIONS.forEach((key) => { | ||
if (options[key] !== undefined) { | ||
opts[key] = options[key] | ||
} | ||
}) | ||
} | ||
return slugfyFunction(string, opts) | ||
} | ||
|
||
export default helper(slugify) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.block { | ||
margin-bottom: 40px; | ||
} | ||
|
||
.code { | ||
font-weight: bold; | ||
font-family: monospace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
{{page-title "Dummy"}} | ||
{{page-title "ember-slugify"}} | ||
|
||
<h2 id="title">Welcome to Ember</h2> | ||
<h2 id="title">Welcome to ember-slugify</h2> | ||
|
||
<div class="block"> | ||
<p class="code">\{{slugify "Le Théâtre"}}</p> | ||
<p>{{slugify "Le Théâtre"}}</p> | ||
</div> | ||
|
||
<div class="block"> | ||
<p class="code">\{{slugify "I ♥ New York"}}</p> | ||
<p>{{slugify "I ♥ New York"}}</p> | ||
</div> | ||
|
||
<div class="block"> | ||
<p class="code">\{{slugify "你好你怎么样 monsieur" (hash pinyin=true)}}</p> | ||
<p>{{slugify "你好你怎么样 monsieur" (hash pinyin=true)}}</p> | ||
</div> | ||
|
||
<div class="block"> | ||
<p class="code">\{{slugify "🇫🇷❤️🥖➕🍷" (hash emoji=true)}}</p> | ||
<p>{{slugify "🇫🇷❤️🥖➕🍷" (hash emoji=true)}}</p> | ||
</div> | ||
|
||
<div class="block"> | ||
<p class="code">\{{remove-diacritics "Le Théâtre"}}</p> | ||
<p>{{remove-diacritics "Le Théâtre"}}</p> | ||
</div> | ||
|
||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.