Squashed commit of the following:

commit fea85fa8a47b4ccedb2b502b4537c6b261dc3eed
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Feb 3 16:41:57 2017 +0000

    Make emoji more accessible

commit 2bcb6e999b85aad361754f667ab8305db538176f
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Jan 27 20:51:50 2017 +0000

    Add an emoji into the seed file to test a11y
    techniques with.
This commit is contained in:
Jonny Barnes 2017-02-03 16:42:39 +00:00
parent 13919c207e
commit c0a4e220c4
4 changed files with 52 additions and 4 deletions

View file

@ -6,6 +6,7 @@ use Normalizer;
use Laravel\Scout\Searchable;
use Jonnybarnes\IndieWeb\Numbers;
use Illuminate\Database\Eloquent\Model;
use Jonnybarnes\EmojiA11y\EmojiModifier;
use League\CommonMark\CommonMarkConverter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
@ -119,11 +120,13 @@ class Note extends Model implements HasMedia
public function getNoteAttribute($value)
{
$markdown = new CommonMarkConverter();
$emoji = new EmojiModifier();
$html = $markdown->convertToHtml($value);
$hcards = $this->makeHCards($html);
$hashtags = $this->autoLinkHashtag($hcards);
$modified = $emoji->makeEmojiAccessible($hashtags);
return $hashtags;
return $modified;
}
/**

View file

@ -24,7 +24,8 @@
"lcobucci/jwt": "^3.1",
"sensiolabs/security-checker": "^4.0",
"laravel/scout": "^1.1",
"pmatseykanets/laravel-scout-postgres": "^0.2.0"
"pmatseykanets/laravel-scout-postgres": "^0.2.0",
"jonnybarnes/emoji-a11y": "^0.1.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",

46
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "f01992db8f967fa62b1a66a60d43be59",
"content-hash": "2fde3e4238c4f285f6c6d2348a6d695c",
"packages": [
{
"name": "anahkiasen/underscore-php",
@ -1443,6 +1443,50 @@
],
"time": "2015-09-27T15:35:21+00:00"
},
{
"name": "jonnybarnes/emoji-a11y",
"version": "v0.1.1",
"source": {
"type": "git",
"url": "https://github.com/jonnybarnes/emoji-a11y.git",
"reference": "bb9d7427bdaab139d746de1c4273fea6ebc52206"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jonnybarnes/emoji-a11y/zipball/bb9d7427bdaab139d746de1c4273fea6ebc52206",
"reference": "bb9d7427bdaab139d746de1c4273fea6ebc52206",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Jonnybarnes\\EmojiA11y\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"CC0-1.0"
],
"authors": [
{
"name": "Jonny Barnes",
"email": "jonny@jonnybarnes.uk"
}
],
"description": "Make emoji more accessible",
"keywords": [
"a11y",
"accessibility",
"emoji"
],
"time": "2017-02-02T00:20:12+00:00"
},
{
"name": "jonnybarnes/indieweb",
"version": "dev-master",

View file

@ -13,7 +13,7 @@ class NotesTableSeeder extends Seeder
{
factory(App\Note::class, 10)->create();
$noteWithPlace = App\Note::create([
'note' => 'Having a #beer at the local.',
'note' => 'Having a #beer at the local. 🍺',
'tweet_id' => '123456789',
]);
$place = App\Place::find(1);