emoji_for_jekyll 0.2.3 → 1.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 528d1777c7b9ca2515b58eaaecbbcdbbc659e184
4
- data.tar.gz: b2cddc6b20d7dced007b658ae9f9006bd56a195d
3
+ metadata.gz: 9571826671072dd72aa3571645be7b62aaaef420
4
+ data.tar.gz: 0fe410a24672faab030b09454be15c4248ee36cc
5
5
  SHA512:
6
- metadata.gz: 69e56e1ed1545c1bfbd2c54163f291e9bffb59a2d434063c6b6abef0690fb6b66c93b6230b014b0aa720dd04e73836b08bdf71423dc840decdfbd89c09edd3e5
7
- data.tar.gz: 6d0602528829651f2253dd508515eebd71a3d622b5c61aa1cb42b49f2ebd28780dfd2018d04384d3f5bf97a55b3c2bb5380782a47b1e225f2e55287fe7d7d98c
6
+ metadata.gz: b03603fd20b99f90d23c26fabad116d0af6488cbffe3e4d1e4ff4143e83dbf28348ceea4ecb83672f5e93ac6b1f868eefa27fe708c20205329b4a9c9f3659dec
7
+ data.tar.gz: 42c70b3332ee9665009e88c8961f99c286cd501f4a97d3a43ed38c01f18f6906b0d889b69eda17606143b2044332695b79c2bd96369fdf275d125e9a37edf02d
data/README.md CHANGED
@@ -12,61 +12,51 @@ Seamlessly enable emoji for Jekyll.
12
12
  ```
13
13
  3. See beautiful emoji!
14
14
 
15
- _or_
15
+ ## Advanced Options
16
+ Emoji for Jekyll works without any extra configuration. However, we do offer customizability for our users. All options mentioned below sit under the `emoji` key in `_config.yml`. In addition to global settings in `_config.yml`, each of these options can also be used in front-matter to overwrite the global settings.
16
17
 
17
- 1. Copy `emoji_for_jekll.rb` and `emoji.json` into the `_plugins` directory
18
+ ### `enabled`
19
+ Set this to `false` to skip disable Emoji for Jekyll for the entire site or a particular post.
18
20
 
19
- ### GitHub Pages
20
- This plugin (and as a matter of fact, most Jekyll plugins) do not work with GitHub Pages as GitHub
21
- (understandably) do not allow arbitrary code to be executed on their servers. As a result, only
22
- [selected plugins](https://help.github.com/articles/using-jekyll-plugins-with-github-pages/) work
23
- with GitHub pages.
24
-
25
- Here are my suggestions if you are using GitHub Pages:
26
-
27
- 1. Build your site locally and push the content of `_site`.
28
-
29
- 2. Use [Jemoji](https://help.github.com/articles/emoji-on-github-pages/).
30
-
31
- ## Options
32
- ### Whitelist and blacklist
33
- You can also whitelist or blacklist certain emojis. On the posts or pages that you want to whitelist or blacklist certain emojis, add `emoji-whitelist` or `emoji-blacklist` follow by a list of emojis __without__ the colons to the front matter. For example:
21
+ ### `front_matter`
22
+ A list of front-matter keys that should be emojified as well. For example, if we set the following in `_config.yml`:
34
23
 
35
24
  ```yaml
36
- emoji-whitelist:
37
- - bowtie
38
- - blush
39
- ```
40
-
41
- or
42
-
43
- ```yaml
44
- emoji-blacklist:
45
- - smile
25
+ emoji:
26
+ front_matter:
27
+ - title
28
+ - description
29
+ - my_item
46
30
  ```
47
31
 
48
- When both `emoji-whitelist` and `emoji-blacklist` are declared, the effect will be the same as when only the whitelist is declared.
32
+ The values of `title`, `description`, and `my_item` in the front_matter of each post will be emojified.
49
33
 
50
- ### Disabling
51
- You may choose to disable this plugin for certain posts or pages by adding `emoji: false` to the front matter of these posts and pages.
34
+ ### `whitelist` and `blacklist`
35
+ `whitelist` and `blacklist` can be used to enable or disable only certain emoji. Each of `whitelist` and `blacklist` is an array of emoji token, without the colon. For example:
52
36
 
53
- If, for some reason, you want to disable this plugin for the entire site, you can either remove `emoji-for-jekyll.rb` from `_plugins`, or just add `emoji: false` to `_config.yml`.
37
+ ```yaml
38
+ emoji:
39
+ whitelist:
40
+ - smile
41
+ - poop
42
+ ```
54
43
 
55
- ### Emojify front-matter items
56
- If you need to emojify certain items in your front-matter, like `title` or `caption` that is needed for some templates, you can do so by setting `emoji-additional-keys` in `_config.yml`. This setting is optional and expects an array:
44
+ ### `source`
45
+ By default, the images of emoji used are the same as those used on GitHub. It is, however, possible to use your own images. Set `source` to the directory containing all these images. All images in this directory will become emoji, thereby allowing custom emoji.
57
46
 
58
47
  ```yaml
59
- emoji-additional-keys: ["title", "caption"]
48
+ emoji:
49
+ source: asset/emoji
60
50
  ```
61
51
 
62
- ### Custom images
63
- By default the images are sourced from GitHub CDN but should you want to use other images you can by choosing a directory with the setting `emoji-images-path` in `_config.yml`. For example: `emoji-images-path: 'img/emoji'`
52
+ Suppose the `asset/emoji` directory contains the following items:
64
53
 
65
- Images copied into this directory will be added the whitelist. E.g.: `custom.png` would whitelist `:custom:`. Any images with the same name as the emoji list will overwrite the default GitHub emoji image.
54
+ - smile.jpg
55
+ - poop.png
56
+ - my_own_emoji_yo.svg
66
57
 
67
- ## Updating Emoji for Jekyll
68
- Updating Emoji for Jekyll is very easy:
58
+ The following will be converted to use these three images:
69
59
 
70
60
  ```
71
- gem update emoji_for_jekyll
61
+ :smile: :poop: :my_own_emoji_yo:
72
62
  ```
@@ -1 +1 @@
1
- ["+1", "-1", "100", "1234", "1st_place_medal", "2nd_place_medal", "3rd_place_medal", "8ball", "a", "ab", "abc", "abcd", "accept", "aerial_tramway", "afghanistan", "airplane", "aland_islands", "alarm_clock", "albania", "alembic", "algeria", "alien", "ambulance", "american_samoa", "amphora", "anchor", "andorra", "angel", "anger", "angola", "angry", "anguilla", "anguished", "ant", "antarctica", "antigua_barbuda", "apple", "aquarius", "argentina", "aries", "armenia", "arrow_backward", "arrow_double_down", "arrow_double_up", "arrow_down", "arrow_down_small", "arrow_forward", "arrow_heading_down", "arrow_heading_up", "arrow_left", "arrow_lower_left", "arrow_lower_right", "arrow_right", "arrow_right_hook", "arrow_up", "arrow_up_down", "arrow_up_small", "arrow_upper_left", "arrow_upper_right", "arrows_clockwise", "arrows_counterclockwise", "art", "articulated_lorry", "artificial_satellite", "aruba", "asterisk", "astonished", "athletic_shoe", "atm", "atom_symbol", "australia", "austria", "avocado", "azerbaijan", "b", "baby", "baby_bottle", "baby_chick", "baby_symbol", "back", "bacon", "badminton", "baggage_claim", "baguette_bread", "bahamas", "bahrain", "balance_scale", "balloon", "ballot_box", "ballot_box_with_check", "bamboo", "banana", "bangbang", "bangladesh", "bank", "bar_chart", "barbados", "barber", "baseball", "basecamp", "basecampy", "basketball", "basketball_man", "basketball_woman", "bat", "bath", "bathtub", "battery", "beach_umbrella", "bear", "bed", "bee", "beer", "beers", "beetle", "beginner", "belarus", "belgium", "belize", "bell", "bellhop_bell", "benin", "bento", "bermuda", "bhutan", "bicyclist", "bike", "biking_man", "biking_woman", "bikini", "biohazard", "bird", "birthday", "black_circle", "black_flag", "black_heart", "black_joker", "black_large_square", "black_medium_small_square", "black_medium_square", "black_nib", "black_small_square", "black_square_button", "blonde_man", "blonde_woman", "blossom", "blowfish", "blue_book", "blue_car", "blue_heart", "blush", "boar", "boat", "bolivia", "bomb", "book", "bookmark", "bookmark_tabs", "books", "boom", "boot", "bosnia_herzegovina", "botswana", "bouquet", "bow", "bow_and_arrow", "bowing_man", "bowing_woman", "bowling", "bowtie", "boxing_glove", "boy", "brazil", "bread", "bride_with_veil", "bridge_at_night", "briefcase", "british_indian_ocean_territory", "british_virgin_islands", "broken_heart", "brunei", "bug", "building_construction", "bulb", "bulgaria", "bullettrain_front", "bullettrain_side", "burkina_faso", "burrito", "burundi", "bus", "business_suit_levitating", "busstop", "bust_in_silhouette", "busts_in_silhouette", "butterfly", "cactus", "cake", "calendar", "call_me_hand", "calling", "cambodia", "camel", "camera", "camera_flash", "cameroon", "camping", "canada", "canary_islands", "cancer", "candle", "candy", "canoe", "cape_verde", "capital_abcd", "capricorn", "car", "card_file_box", "card_index", "card_index_dividers", "caribbean_netherlands", "carousel_horse", "carrot", "cat", "cat2", "cayman_islands", "cd", "central_african_republic", "chad", "chains", "champagne", "chart", "chart_with_downwards_trend", "chart_with_upwards_trend", "checkered_flag", "cheese", "cherries", "cherry_blossom", "chestnut", "chicken", "children_crossing", "chile", "chipmunk", "chocolate_bar", "christmas_island", "christmas_tree", "church", "cinema", "circus_tent", "city_sunrise", "city_sunset", "cityscape", "cl", "clamp", "clap", "clapper", "classical_building", "clinking_glasses", "clipboard", "clock1", "clock10", "clock1030", "clock11", "clock1130", "clock12", "clock1230", "clock130", "clock2", "clock230", "clock3", "clock330", "clock4", "clock430", "clock5", "clock530", "clock6", "clock630", "clock7", "clock730", "clock8", "clock830", "clock9", "clock930", "closed_book", "closed_lock_with_key", "closed_umbrella", "cloud", "cloud_with_lightning", "cloud_with_lightning_and_rain", "cloud_with_rain", "cloud_with_snow", "clown_face", "clubs", "cn", "cocktail", "cocos_islands", "coffee", "coffin", "cold_sweat", "collision", "colombia", "comet", "comoros", "computer", "computer_mouse", "confetti_ball", "confounded", "confused", "congo_brazzaville", "congo_kinshasa", "congratulations", "construction", "construction_worker", "construction_worker_man", "construction_worker_woman", "control_knobs", "convenience_store", "cook_islands", "cookie", "cool", "cop", "copyright", "corn", "costa_rica", "cote_divoire", "couch_and_lamp", "couple", "couple_with_heart", "couple_with_heart_man_man", "couple_with_heart_woman_man", "couple_with_heart_woman_woman", "couplekiss_man_man", "couplekiss_man_woman", "couplekiss_woman_woman", "cow", "cow2", "cowboy_hat_face", "crab", "crayon", "credit_card", "crescent_moon", "cricket", "croatia", "crocodile", "croissant", "crossed_fingers", "crossed_flags", "crossed_swords", "crown", "cry", "crying_cat_face", "crystal_ball", "cuba", "cucumber", "cupid", "curacao", "curly_loop", "currency_exchange", "curry", "custard", "customs", "cyclone", "cyprus", "czech_republic", "dagger", "dancer", "dancers", "dancing_men", "dancing_women", "dango", "dark_sunglasses", "dart", "dash", "date", "de", "deciduous_tree", "deer", "denmark", "department_store", "derelict_house", "desert", "desert_island", "desktop_computer", "detective", "diamond_shape_with_a_dot_inside", "diamonds", "disappointed", "disappointed_relieved", "dizzy", "dizzy_face", "djibouti", "do_not_litter", "dog", "dog2", "dollar", "dolls", "dolphin", "dominica", "dominican_republic", "door", "doughnut", "dove", "dragon", "dragon_face", "dress", "dromedary_camel", "drooling_face", "droplet", "drum", "duck", "dvd", "e-mail", "eagle", "ear", "ear_of_rice", "earth_africa", "earth_americas", "earth_asia", "ecuador", "egg", "eggplant", "egypt", "eight", "eight_pointed_black_star", "eight_spoked_asterisk", "el_salvador", "electric_plug", "elephant", "email", "end", "envelope", "envelope_with_arrow", "equatorial_guinea", "eritrea", "es", "estonia", "ethiopia", "eu", "euro", "european_castle", "european_post_office", "european_union", "evergreen_tree", "exclamation", "expressionless", "eye", "eye_speech_bubble", "eyeglasses", "eyes", "face_with_head_bandage", "face_with_thermometer", "facepunch", "factory", "falkland_islands", "fallen_leaf", "family", "family_man_boy", "family_man_boy_boy", "family_man_girl", "family_man_girl_boy", "family_man_girl_girl", "family_man_man_boy", "family_man_man_boy_boy", "family_man_man_girl", "family_man_man_girl_boy", "family_man_man_girl_girl", "family_man_woman_boy", "family_man_woman_boy_boy", "family_man_woman_girl", "family_man_woman_girl_boy", "family_man_woman_girl_girl", "family_woman_boy", "family_woman_boy_boy", "family_woman_girl", "family_woman_girl_boy", "family_woman_girl_girl", "family_woman_woman_boy", "family_woman_woman_boy_boy", "family_woman_woman_girl", "family_woman_woman_girl_boy", "family_woman_woman_girl_girl", "faroe_islands", "fast_forward", "fax", "fearful", "feelsgood", "feet", "female_detective", "ferris_wheel", "ferry", "field_hockey", "fiji", "file_cabinet", "file_folder", "film_projector", "film_strip", "finland", "finnadie", "fire", "fire_engine", "fireworks", "first_quarter_moon", "first_quarter_moon_with_face", "fish", "fish_cake", "fishing_pole_and_fish", "fist", "fist_left", "fist_oncoming", "fist_raised", "fist_right", "five", "flags", "flashlight", "fleur_de_lis", "flight_arrival", "flight_departure", "flipper", "floppy_disk", "flower_playing_cards", "flushed", "fog", "foggy", "football", "footprints", "fork_and_knife", "fountain", "fountain_pen", "four", "four_leaf_clover", "fox_face", "fr", "framed_picture", "free", "french_guiana", "french_polynesia", "french_southern_territories", "fried_egg", "fried_shrimp", "fries", "frog", "frowning", "frowning_face", "frowning_man", "frowning_woman", "fu", "fuelpump", "full_moon", "full_moon_with_face", "funeral_urn", "gabon", "gambia", "game_die", "gb", "gear", "gem", "gemini", "georgia", "ghana", "ghost", "gibraltar", "gift", "gift_heart", "girl", "globe_with_meridians", "goal_net", "goat", "goberserk", "godmode", "golf", "golfing_man", "golfing_woman", "gorilla", "grapes", "greece", "green_apple", "green_book", "green_heart", "green_salad", "greenland", "grenada", "grey_exclamation", "grey_question", "grimacing", "grin", "grinning", "guadeloupe", "guam", "guardsman", "guardswoman", "guatemala", "guernsey", "guinea", "guinea_bissau", "guitar", "gun", "guyana", "haircut", "haircut_man", "haircut_woman", "haiti", "hamburger", "hammer", "hammer_and_pick", "hammer_and_wrench", "hamster", "hand", "handbag", "handshake", "hankey", "hash", "hatched_chick", "hatching_chick", "headphones", "hear_no_evil", "heart", "heart_decoration", "heart_eyes", "heart_eyes_cat", "heartbeat", "heartpulse", "hearts", "heavy_check_mark", "heavy_division_sign", "heavy_dollar_sign", "heavy_exclamation_mark", "heavy_heart_exclamation", "heavy_minus_sign", "heavy_multiplication_x", "heavy_plus_sign", "helicopter", "herb", "hibiscus", "high_brightness", "high_heel", "hocho", "hole", "honduras", "honey_pot", "honeybee", "hong_kong", "horse", "horse_racing", "hospital", "hot_pepper", "hotdog", "hotel", "hotsprings", "hourglass", "hourglass_flowing_sand", "house", "house_with_garden", "houses", "hugs", "hungary", "hurtrealbad", "hushed", "ice_cream", "ice_hockey", "ice_skate", "icecream", "iceland", "id", "ideograph_advantage", "imp", "inbox_tray", "incoming_envelope", "india", "indonesia", "information_desk_person", "information_source", "innocent", "interrobang", "iphone", "iran", "iraq", "ireland", "isle_of_man", "israel", "it", "izakaya_lantern", "jack_o_lantern", "jamaica", "japan", "japanese_castle", "japanese_goblin", "japanese_ogre", "jeans", "jersey", "jordan", "joy", "joy_cat", "joystick", "jp", "kaaba", "kazakhstan", "kenya", "key", "keyboard", "keycap_ten", "kick_scooter", "kimono", "kiribati", "kiss", "kissing", "kissing_cat", "kissing_closed_eyes", "kissing_heart", "kissing_smiling_eyes", "kiwi_fruit", "knife", "koala", "koko", "kosovo", "kr", "kuwait", "kyrgyzstan", "label", "lantern", "laos", "large_blue_circle", "large_blue_diamond", "large_orange_diamond", "last_quarter_moon", "last_quarter_moon_with_face", "latin_cross", "latvia", "laughing", "leaves", "lebanon", "ledger", "left_luggage", "left_right_arrow", "leftwards_arrow_with_hook", "lemon", "leo", "leopard", "lesotho", "level_slider", "liberia", "libra", "libya", "liechtenstein", "light_rail", "link", "lion", "lips", "lipstick", "lithuania", "lizard", "lock", "lock_with_ink_pen", "lollipop", "loop", "loud_sound", "loudspeaker", "love_hotel", "love_letter", "low_brightness", "luxembourg", "lying_face", "m", "macau", "macedonia", "madagascar", "mag", "mag_right", "mahjong", "mailbox", "mailbox_closed", "mailbox_with_mail", "mailbox_with_no_mail", "malawi", "malaysia", "maldives", "male_detective", "mali", "malta", "man", "man_artist", "man_astronaut", "man_cartwheeling", "man_cook", "man_dancing", "man_facepalming", "man_factory_worker", "man_farmer", "man_firefighter", "man_health_worker", "man_in_tuxedo", "man_judge", "man_juggling", "man_mechanic", "man_office_worker", "man_pilot", "man_playing_handball", "man_playing_water_polo", "man_scientist", "man_shrugging", "man_singer", "man_student", "man_teacher", "man_technologist", "man_with_gua_pi_mao", "man_with_turban", "mandarin", "mans_shoe", "mantelpiece_clock", "maple_leaf", "marshall_islands", "martial_arts_uniform", "martinique", "mask", "massage", "massage_man", "massage_woman", "mauritania", "mauritius", "mayotte", "meat_on_bone", "medal_military", "medal_sports", "mega", "melon", "memo", "men_wrestling", "menorah", "mens", "metal", "metro", "mexico", "micronesia", "microphone", "microscope", "middle_finger", "milk_glass", "milky_way", "minibus", "minidisc", "mobile_phone_off", "moldova", "monaco", "money_mouth_face", "money_with_wings", "moneybag", "mongolia", "monkey", "monkey_face", "monorail", "montenegro", "montserrat", "moon", "morocco", "mortar_board", "mosque", "motor_boat", "motor_scooter", "motorcycle", "motorway", "mount_fuji", "mountain", "mountain_bicyclist", "mountain_biking_man", "mountain_biking_woman", "mountain_cableway", "mountain_railway", "mountain_snow", "mouse", "mouse2", "movie_camera", "moyai", "mozambique", "mrs_claus", "muscle", "mushroom", "musical_keyboard", "musical_note", "musical_score", "mute", "myanmar", "nail_care", "name_badge", "namibia", "national_park", "nauru", "nauseated_face", "neckbeard", "necktie", "negative_squared_cross_mark", "nepal", "nerd_face", "netherlands", "neutral_face", "new", "new_caledonia", "new_moon", "new_moon_with_face", "new_zealand", "newspaper", "newspaper_roll", "next_track_button", "ng", "ng_man", "ng_woman", "nicaragua", "niger", "nigeria", "night_with_stars", "nine", "niue", "no_bell", "no_bicycles", "no_entry", "no_entry_sign", "no_good", "no_good_man", "no_good_woman", "no_mobile_phones", "no_mouth", "no_pedestrians", "no_smoking", "non-potable_water", "norfolk_island", "north_korea", "northern_mariana_islands", "norway", "nose", "notebook", "notebook_with_decorative_cover", "notes", "nut_and_bolt", "o", "o2", "ocean", "octocat", "octopus", "oden", "office", "oil_drum", "ok", "ok_hand", "ok_man", "ok_woman", "old_key", "older_man", "older_woman", "om", "oman", "on", "oncoming_automobile", "oncoming_bus", "oncoming_police_car", "oncoming_taxi", "one", "open_book", "open_file_folder", "open_hands", "open_mouth", "open_umbrella", "ophiuchus", "orange", "orange_book", "orthodox_cross", "outbox_tray", "owl", "ox", "package", "page_facing_up", "page_with_curl", "pager", "paintbrush", "pakistan", "palau", "palestinian_territories", "palm_tree", "panama", "pancakes", "panda_face", "paperclip", "paperclips", "papua_new_guinea", "paraguay", "parasol_on_ground", "parking", "part_alternation_mark", "partly_sunny", "passenger_ship", "passport_control", "pause_button", "paw_prints", "peace_symbol", "peach", "peanuts", "pear", "pen", "pencil", "pencil2", "penguin", "pensive", "performing_arts", "persevere", "person_fencing", "person_frowning", "person_with_blond_hair", "person_with_pouting_face", "peru", "philippines", "phone", "pick", "pig", "pig2", "pig_nose", "pill", "pineapple", "ping_pong", "pisces", "pitcairn_islands", "pizza", "place_of_worship", "plate_with_cutlery", "play_or_pause_button", "point_down", "point_left", "point_right", "point_up", "point_up_2", "poland", "police_car", "policeman", "policewoman", "poodle", "poop", "popcorn", "portugal", "post_office", "postal_horn", "postbox", "potable_water", "potato", "pouch", "poultry_leg", "pound", "pout", "pouting_cat", "pouting_man", "pouting_woman", "pray", "prayer_beads", "pregnant_woman", "previous_track_button", "prince", "princess", "printer", "puerto_rico", "punch", "purple_heart", "purse", "pushpin", "put_litter_in_its_place", "qatar", "question", "rabbit", "rabbit2", "racehorse", "racing_car", "radio", "radio_button", "radioactive", "rage", "rage1", "rage2", "rage3", "rage4", "railway_car", "railway_track", "rainbow", "rainbow_flag", "raised_back_of_hand", "raised_hand", "raised_hand_with_fingers_splayed", "raised_hands", "raising_hand", "raising_hand_man", "raising_hand_woman", "ram", "ramen", "rat", "record_button", "recycle", "red_car", "red_circle", "registered", "relaxed", "relieved", "reminder_ribbon", "repeat", "repeat_one", "rescue_worker_helmet", "restroom", "reunion", "revolving_hearts", "rewind", "rhinoceros", "ribbon", "rice", "rice_ball", "rice_cracker", "rice_scene", "right_anger_bubble", "ring", "robot", "rocket", "rofl", "roll_eyes", "roller_coaster", "romania", "rooster", "rose", "rosette", "rotating_light", "round_pushpin", "rowboat", "rowing_man", "rowing_woman", "ru", "rugby_football", "runner", "running", "running_man", "running_shirt_with_sash", "running_woman", "rwanda", "sa", "sagittarius", "sailboat", "sake", "samoa", "san_marino", "sandal", "santa", "sao_tome_principe", "satellite", "satisfied", "saudi_arabia", "saxophone", "school", "school_satchel", "scissors", "scorpion", "scorpius", "scream", "scream_cat", "scroll", "seat", "secret", "see_no_evil", "seedling", "selfie", "senegal", "serbia", "seven", "seychelles", "shallow_pan_of_food", "shamrock", "shark", "shaved_ice", "sheep", "shell", "shield", "shinto_shrine", "ship", "shipit", "shirt", "shit", "shoe", "shopping", "shopping_cart", "shower", "shrimp", "sierra_leone", "signal_strength", "singapore", "sint_maarten", "six", "six_pointed_star", "ski", "skier", "skull", "skull_and_crossbones", "sleeping", "sleeping_bed", "sleepy", "slightly_frowning_face", "slightly_smiling_face", "slot_machine", "slovakia", "slovenia", "small_airplane", "small_blue_diamond", "small_orange_diamond", "small_red_triangle", "small_red_triangle_down", "smile", "smile_cat", "smiley", "smiley_cat", "smiling_imp", "smirk", "smirk_cat", "smoking", "snail", "snake", "sneezing_face", "snowboarder", "snowflake", "snowman", "snowman_with_snow", "sob", "soccer", "solomon_islands", "somalia", "soon", "sos", "sound", "south_africa", "south_georgia_south_sandwich_islands", "south_sudan", "space_invader", "spades", "spaghetti", "sparkle", "sparkler", "sparkles", "sparkling_heart", "speak_no_evil", "speaker", "speaking_head", "speech_balloon", "speedboat", "spider", "spider_web", "spiral_calendar", "spiral_notepad", "spoon", "squid", "squirrel", "sri_lanka", "st_barthelemy", "st_helena", "st_kitts_nevis", "st_lucia", "st_pierre_miquelon", "st_vincent_grenadines", "stadium", "star", "star2", "star_and_crescent", "star_of_david", "stars", "station", "statue_of_liberty", "steam_locomotive", "stew", "stop_button", "stop_sign", "stopwatch", "straight_ruler", "strawberry", "stuck_out_tongue", "stuck_out_tongue_closed_eyes", "stuck_out_tongue_winking_eye", "studio_microphone", "stuffed_flatbread", "sudan", "sun_behind_large_cloud", "sun_behind_rain_cloud", "sun_behind_small_cloud", "sun_with_face", "sunflower", "sunglasses", "sunny", "sunrise", "sunrise_over_mountains", "surfer", "surfing_man", "surfing_woman", "suriname", "sushi", "suspect", "suspension_railway", "swaziland", "sweat", "sweat_drops", "sweat_smile", "sweden", "sweet_potato", "swimmer", "swimming_man", "swimming_woman", "switzerland", "symbols", "synagogue", "syria", "syringe", "taco", "tada", "taiwan", "tajikistan", "tanabata_tree", "tangerine", "tanzania", "taurus", "taxi", "tea", "telephone", "telephone_receiver", "telescope", "tennis", "tent", "thailand", "thermometer", "thinking", "thought_balloon", "three", "thumbsdown", "thumbsup", "ticket", "tickets", "tiger", "tiger2", "timer_clock", "timor_leste", "tipping_hand_man", "tipping_hand_woman", "tired_face", "tm", "togo", "toilet", "tokelau", "tokyo_tower", "tomato", "tonga", "tongue", "top", "tophat", "tornado", "tr", "trackball", "tractor", "traffic_light", "train", "train2", "tram", "triangular_flag_on_post", "triangular_ruler", "trident", "trinidad_tobago", "triumph", "trolleybus", "trollface", "trophy", "tropical_drink", "tropical_fish", "truck", "trumpet", "tshirt", "tulip", "tumbler_glass", "tunisia", "turkey", "turkmenistan", "turks_caicos_islands", "turtle", "tuvalu", "tv", "twisted_rightwards_arrows", "two", "two_hearts", "two_men_holding_hands", "two_women_holding_hands", "u5272", "u5408", "u55b6", "u6307", "u6708", "u6709", "u6e80", "u7121", "u7533", "u7981", "u7a7a", "uganda", "uk", "ukraine", "umbrella", "unamused", "underage", "unicorn", "united_arab_emirates", "unlock", "up", "upside_down_face", "uruguay", "us", "us_virgin_islands", "uzbekistan", "v", "vanuatu", "vatican_city", "venezuela", "vertical_traffic_light", "vhs", "vibration_mode", "video_camera", "video_game", "vietnam", "violin", "virgo", "volcano", "volleyball", "vs", "vulcan_salute", "walking", "walking_man", "walking_woman", "wallis_futuna", "waning_crescent_moon", "waning_gibbous_moon", "warning", "wastebasket", "watch", "water_buffalo", "watermelon", "wave", "wavy_dash", "waxing_crescent_moon", "waxing_gibbous_moon", "wc", "weary", "wedding", "weight_lifting_man", "weight_lifting_woman", "western_sahara", "whale", "whale2", "wheel_of_dharma", "wheelchair", "white_check_mark", "white_circle", "white_flag", "white_flower", "white_large_square", "white_medium_small_square", "white_medium_square", "white_small_square", "white_square_button", "wilted_flower", "wind_chime", "wind_face", "wine_glass", "wink", "wolf", "woman", "woman_artist", "woman_astronaut", "woman_cartwheeling", "woman_cook", "woman_facepalming", "woman_factory_worker", "woman_farmer", "woman_firefighter", "woman_health_worker", "woman_judge", "woman_juggling", "woman_mechanic", "woman_office_worker", "woman_pilot", "woman_playing_handball", "woman_playing_water_polo", "woman_scientist", "woman_shrugging", "woman_singer", "woman_student", "woman_teacher", "woman_technologist", "woman_with_turban", "womans_clothes", "womans_hat", "women_wrestling", "womens", "world_map", "worried", "wrench", "writing_hand", "x", "yellow_heart", "yemen", "yen", "yin_yang", "yum", "zambia", "zap", "zero", "zimbabwe", "zipper_mouth_face", "zzz"]
1
+ ["+1", "-1", "100", "1234", "8ball", "a", "ab", "abc", "abcd", "accept", "aerial_tramway", "airplane", "alarm_clock", "alien", "ambulance", "anchor", "angel", "anger", "angry", "anguished", "ant", "apple", "aquarius", "aries", "arrow_backward", "arrow_double_down", "arrow_double_up", "arrow_down", "arrow_down_small", "arrow_forward", "arrow_heading_down", "arrow_heading_up", "arrow_left", "arrow_lower_left", "arrow_lower_right", "arrow_right", "arrow_right_hook", "arrow_up", "arrow_up_down", "arrow_up_small", "arrow_upper_left", "arrow_upper_right", "arrows_clockwise", "arrows_counterclockwise", "art", "articulated_lorry", "astonished", "athletic_shoe", "atm", "b", "baby", "baby_bottle", "baby_chick", "baby_symbol", "back", "baggage_claim", "balloon", "ballot_box_with_check", "bamboo", "banana", "bangbang", "bank", "bar_chart", "barber", "baseball", "basketball", "bath", "bathtub", "battery", "bear", "bee", "beer", "beers", "beetle", "beginner", "bell", "bento", "bicyclist", "bike", "bikini", "bird", "birthday", "black_circle", "black_joker", "black_large_square", "black_medium_small_square", "black_medium_square", "black_nib", "black_small_square", "black_square_button", "blossom", "blowfish", "blue_book", "blue_car", "blue_heart", "blush", "boar", "boat", "bomb", "book", "bookmark", "bookmark_tabs", "books", "boom", "boot", "bouquet", "bow", "bowling", "bowtie", "boy", "bread", "bride_with_veil", "bridge_at_night", "briefcase", "broken_heart", "bug", "bulb", "bullettrain_front", "bullettrain_side", "bus", "busstop", "bust_in_silhouette", "busts_in_silhouette", "cactus", "cake", "calendar", "calling", "camel", "camera", "cancer", "candy", "capital_abcd", "capricorn", "car", "card_index", "carousel_horse", "cat", "cat2", "cd", "chart", "chart_with_downwards_trend", "chart_with_upwards_trend", "checkered_flag", "cherries", "cherry_blossom", "chestnut", "chicken", "children_crossing", "chocolate_bar", "christmas_tree", "church", "cinema", "circus_tent", "city_sunrise", "city_sunset", "cl", "clap", "clapper", "clipboard", "clock1", "clock10", "clock1030", "clock11", "clock1130", "clock12", "clock1230", "clock130", "clock2", "clock230", "clock3", "clock330", "clock4", "clock430", "clock5", "clock530", "clock6", "clock630", "clock7", "clock730", "clock8", "clock830", "clock9", "clock930", "closed_book", "closed_lock_with_key", "closed_umbrella", "cloud", "clubs", "cn", "cocktail", "coffee", "cold_sweat", "collision", "computer", "confetti_ball", "confounded", "confused", "congratulations", "construction", "construction_worker", "convenience_store", "cookie", "cool", "cop", "copyright", "corn", "couple", "couple_with_heart", "couplekiss", "cow", "cow2", "credit_card", "crescent_moon", "crocodile", "crossed_flags", "crown", "cry", "crying_cat_face", "crystal_ball", "cupid", "curly_loop", "currency_exchange", "curry", "custard", "customs", "cyclone", "dancer", "dancers", "dango", "dart", "dash", "date", "de", "deciduous_tree", "department_store", "diamond_shape_with_a_dot_inside", "diamonds", "disappointed", "disappointed_relieved", "dizzy", "dizzy_face", "do_not_litter", "dog", "dog2", "dollar", "dolls", "dolphin", "door", "doughnut", "dragon", "dragon_face", "dress", "dromedary_camel", "droplet", "dvd", "e-mail", "ear", "ear_of_rice", "earth_africa", "earth_americas", "earth_asia", "egg", "eggplant", "eight", "eight_pointed_black_star", "eight_spoked_asterisk", "electric_plug", "elephant", "email", "end", "envelope", "envelope_with_arrow", "es", "euro", "european_castle", "european_post_office", "evergreen_tree", "exclamation", "expressionless", "eyeglasses", "eyes", "facepunch", "factory", "fallen_leaf", "family", "fast_forward", "fax", "fearful", "feelsgood", "feet", "ferris_wheel", "file_folder", "finnadie", "fire", "fire_engine", "fireworks", "first_quarter_moon", "first_quarter_moon_with_face", "fish", "fish_cake", "fishing_pole_and_fish", "fist", "five", "flags", "flashlight", "flipper", "floppy_disk", "flower_playing_cards", "flushed", "foggy", "football", "footprints", "fork_and_knife", "fountain", "four", "four_leaf_clover", "fr", "free", "fried_shrimp", "fries", "frog", "frowning", "fu", "fuelpump", "full_moon", "full_moon_with_face", "game_die", "gb", "gem", "gemini", "ghost", "gift", "gift_heart", "girl", "globe_with_meridians", "goat", "goberserk", "godmode", "golf", "grapes", "green_apple", "green_book", "green_heart", "grey_exclamation", "grey_question", "grimacing", "grin", "grinning", "guardsman", "guitar", "gun", "haircut", "hamburger", "hammer", "hamster", "hand", "handbag", "hankey", "hash", "hatched_chick", "hatching_chick", "headphones", "hear_no_evil", "heart", "heart_decoration", "heart_eyes", "heart_eyes_cat", "heartbeat", "heartpulse", "hearts", "heavy_check_mark", "heavy_division_sign", "heavy_dollar_sign", "heavy_exclamation_mark", "heavy_minus_sign", "heavy_multiplication_x", "heavy_plus_sign", "helicopter", "herb", "hibiscus", "high_brightness", "high_heel", "hocho", "honey_pot", "honeybee", "horse", "horse_racing", "hospital", "hotel", "hotsprings", "hourglass", "hourglass_flowing_sand", "house", "house_with_garden", "hurtrealbad", "hushed", "ice_cream", "icecream", "id", "ideograph_advantage", "imp", "inbox_tray", "incoming_envelope", "information_desk_person", "information_source", "innocent", "interrobang", "iphone", "it", "izakaya_lantern", "jack_o_lantern", "japan", "japanese_castle", "japanese_goblin", "japanese_ogre", "jeans", "joy", "joy_cat", "jp", "key", "keycap_ten", "kimono", "kiss", "kissing", "kissing_cat", "kissing_closed_eyes", "kissing_heart", "kissing_smiling_eyes", "koala", "koko", "kr", "lantern", "large_blue_circle", "large_blue_diamond", "large_orange_diamond", "last_quarter_moon", "last_quarter_moon_with_face", "laughing", "leaves", "ledger", "left_luggage", "left_right_arrow", "leftwards_arrow_with_hook", "lemon", "leo", "leopard", "libra", "light_rail", "link", "lips", "lipstick", "lock", "lock_with_ink_pen", "lollipop", "loop", "loud_sound", "loudspeaker", "love_hotel", "love_letter", "low_brightness", "m", "mag", "mag_right", "mahjong", "mailbox", "mailbox_closed", "mailbox_with_mail", "mailbox_with_no_mail", "man", "man_with_gua_pi_mao", "man_with_turban", "mans_shoe", "maple_leaf", "mask", "massage", "meat_on_bone", "mega", "melon", "memo", "mens", "metal", "metro", "microphone", "microscope", "milky_way", "minibus", "minidisc", "mobile_phone_off", "money_with_wings", "moneybag", "monkey", "monkey_face", "monorail", "moon", "mortar_board", "mount_fuji", "mountain_bicyclist", "mountain_cableway", "mountain_railway", "mouse", "mouse2", "movie_camera", "moyai", "muscle", "mushroom", "musical_keyboard", "musical_note", "musical_score", "mute", "nail_care", "name_badge", "neckbeard", "necktie", "negative_squared_cross_mark", "neutral_face", "new", "new_moon", "new_moon_with_face", "newspaper", "ng", "night_with_stars", "nine", "no_bell", "no_bicycles", "no_entry", "no_entry_sign", "no_good", "no_mobile_phones", "no_mouth", "no_pedestrians", "no_smoking", "non-potable_water", "nose", "notebook", "notebook_with_decorative_cover", "notes", "nut_and_bolt", "o", "o2", "ocean", "octocat", "octopus", "oden", "office", "ok", "ok_hand", "ok_woman", "older_man", "older_woman", "on", "oncoming_automobile", "oncoming_bus", "oncoming_police_car", "oncoming_taxi", "one", "open_book", "open_file_folder", "open_hands", "open_mouth", "ophiuchus", "orange_book", "outbox_tray", "ox", "package", "page_facing_up", "page_with_curl", "pager", "palm_tree", "panda_face", "paperclip", "parking", "part_alternation_mark", "partly_sunny", "passport_control", "paw_prints", "peach", "pear", "pencil", "pencil2", "penguin", "pensive", "performing_arts", "persevere", "person_frowning", "person_with_blond_hair", "person_with_pouting_face", "phone", "pig", "pig2", "pig_nose", "pill", "pineapple", "pisces", "pizza", "point_down", "point_left", "point_right", "point_up", "point_up_2", "police_car", "poodle", "poop", "post_office", "postal_horn", "postbox", "potable_water", "pouch", "poultry_leg", "pound", "pouting_cat", "pray", "princess", "punch", "purple_heart", "purse", "pushpin", "put_litter_in_its_place", "question", "rabbit", "rabbit2", "racehorse", "radio", "radio_button", "rage", "rage1", "rage2", "rage3", "rage4", "railway_car", "rainbow", "raised_hand", "raised_hands", "raising_hand", "ram", "ramen", "rat", "recycle", "red_car", "red_circle", "registered", "relaxed", "relieved", "repeat", "repeat_one", "restroom", "revolving_hearts", "rewind", "ribbon", "rice", "rice_ball", "rice_cracker", "rice_scene", "ring", "rocket", "roller_coaster", "rooster", "rose", "rotating_light", "round_pushpin", "rowboat", "ru", "rugby_football", "runner", "running", "running_shirt_with_sash", "sa", "sagittarius", "sailboat", "sake", "sandal", "santa", "satellite", "satisfied", "saxophone", "school", "school_satchel", "scissors", "scorpius", "scream", "scream_cat", "scroll", "seat", "secret", "see_no_evil", "seedling", "seven", "shaved_ice", "sheep", "shell", "ship", "shipit", "shirt", "shit", "shoe", "shower", "signal_strength", "six", "six_pointed_star", "ski", "skull", "sleeping", "sleepy", "slot_machine", "small_blue_diamond", "small_orange_diamond", "small_red_triangle", "small_red_triangle_down", "smile", "smile_cat", "smiley", "smiley_cat", "smiling_imp", "smirk", "smirk_cat", "smoking", "snail", "snake", "snowboarder", "snowflake", "snowman", "sob", "soccer", "soon", "sos", "sound", "space_invader", "spades", "spaghetti", "sparkle", "sparkler", "sparkles", "sparkling_heart", "speak_no_evil", "speaker", "speech_balloon", "speedboat", "squirrel", "star", "star2", "stars", "station", "statue_of_liberty", "steam_locomotive", "stew", "straight_ruler", "strawberry", "stuck_out_tongue", "stuck_out_tongue_closed_eyes", "stuck_out_tongue_winking_eye", "sun_with_face", "sunflower", "sunglasses", "sunny", "sunrise", "sunrise_over_mountains", "surfer", "sushi", "suspect", "suspension_railway", "sweat", "sweat_drops", "sweat_smile", "sweet_potato", "swimmer", "symbols", "syringe", "tada", "tanabata_tree", "tangerine", "taurus", "taxi", "tea", "telephone", "telephone_receiver", "telescope", "tennis", "tent", "thought_balloon", "three", "thumbsdown", "thumbsup", "ticket", "tiger", "tiger2", "tired_face", "tm", "toilet", "tokyo_tower", "tomato", "tongue", "top", "tophat", "tractor", "traffic_light", "train", "train2", "tram", "triangular_flag_on_post", "triangular_ruler", "trident", "triumph", "trolleybus", "trollface", "trophy", "tropical_drink", "tropical_fish", "truck", "trumpet", "tshirt", "tulip", "turtle", "tv", "twisted_rightwards_arrows", "two", "two_hearts", "two_men_holding_hands", "two_women_holding_hands", "u5272", "u5408", "u55b6", "u6307", "u6708", "u6709", "u6e80", "u7121", "u7533", "u7981", "u7a7a", "uk", "umbrella", "unamused", "underage", "unlock", "up", "us", "v", "vertical_traffic_light", "vhs", "vibration_mode", "video_camera", "video_game", "violin", "virgo", "volcano", "vs", "walking", "waning_crescent_moon", "waning_gibbous_moon", "warning", "watch", "water_buffalo", "watermelon", "wave", "wavy_dash", "waxing_crescent_moon", "waxing_gibbous_moon", "wc", "weary", "wedding", "whale", "whale2", "wheelchair", "white_check_mark", "white_circle", "white_flower", "white_large_square", "white_medium_small_square", "white_medium_square", "white_small_square", "white_square_button", "wind_chime", "wine_glass", "wink", "wolf", "woman", "womans_clothes", "womans_hat", "womens", "worried", "wrench", "x", "yellow_heart", "yen", "yum", "zap", "zero", "zzz"]
@@ -1,101 +1,2 @@
1
- require 'json'
2
-
3
- module EmojiForJekyll
4
-
5
- class EmojiGenerator < Jekyll::Generator
6
- def generate(site)
7
- if site.config.has_key?("emoji") and !site.config["emoji"]
8
- return
9
- end
10
-
11
- if site.config.has_key?("emoji-additional-keys")
12
- additional_keys = site.config["emoji-additional-keys"]
13
- else
14
- additional_keys = []
15
- end
16
-
17
- get_master_whitelist
18
-
19
- get_images_path(site)
20
-
21
- site.pages.each { |p| substitute(p, additional_keys) }
22
-
23
- (site.posts.respond_to?(:docs) ? site.posts.docs : site.posts ).each { |p| substitute(p, additional_keys) }
24
- end
25
-
26
- private
27
- def get_master_whitelist
28
- # @master_whitelist is an array of all supported emojis
29
- @master_whitelist = JSON.parse(IO.readlines(File.expand_path("emoji.json", File.dirname(__FILE__))).join)
30
- end
31
-
32
- def get_images_path(site)
33
- @images_path = {}
34
- if site.config["emoji-images-path"]
35
-
36
- images_path = site.config["emoji-images-path"]
37
- images_dir = File.join(site.source, images_path)
38
- Dir.foreach(images_dir) do |image_filename|
39
- if /^(?<tag>.*)\.(?:svg|png|jpg|jpeg|gif)/ =~ image_filename
40
- @master_whitelist << tag
41
- @images_path[tag] = File.join("/", images_path, image_filename)
42
- end
43
- end
44
-
45
- end
46
- @master_whitelist.sort!
47
- end
48
-
49
- def substitute(obj, additional_keys)
50
- if obj.data.has_key?("emoji") and !obj.data["emoji"]
51
- return
52
- end
53
-
54
- whitelist = obj.data.has_key?("emoji-whitelist") ? obj.data["emoji-whitelist"] : false
55
- blacklist = obj.data.has_key?("emoji-blacklist") ? obj.data["emoji-blacklist"] : false
56
-
57
- # When both the whitelist and blacklist are defined, whitelist will be prioritized
58
- blacklist = whitelist ? false : blacklist
59
-
60
- filter = Proc.new do |key|
61
- (whitelist and whitelist.include?($1)) or
62
- (blacklist and !blacklist.include?($1)) or
63
- (!whitelist and !blacklist) and
64
- @master_whitelist.bsearch { |i| i >= key } == key
65
- end
66
-
67
- obj.content.gsub!(/:([\w\+\-]+):/) do |s|
68
- convert($1, filter)
69
- end
70
-
71
- additional_keys.each do |key|
72
- if obj.data.has_key?(key)
73
- obj.data[key].gsub!(/:([\w\+\-]+):/) do |s|
74
- convert($1, filter)
75
- end
76
- end
77
- end
78
- end
79
-
80
- # convert takes in the key to the emoji to be converted and an optional block
81
- # If block is provided, conversion will be done only if this block evaluates to true.
82
- def convert(key, block = nil)
83
- if block.nil? or block.call(key)
84
- img_tag(key)
85
- else
86
- ":#{key}:"
87
- end
88
- end
89
-
90
- def img_tag(name)
91
- # if there is an image in the custom images path
92
- if @images_path[name]
93
- img_src = @images_path[name]
94
- else # otherwise use fallback CDN
95
- img_src = "https://github.global.ssl.fastly.net/images/icons/emoji/#{name}.png"
96
- end
97
-
98
- "<img class='emoji' title='#{name}' alt='#{name}' src='#{img_src}' height='20' width='20' align='absmiddle' >"
99
- end
100
- end
101
- end
1
+ require 'emoji_for_jekyll/emojifier'
2
+ require 'emoji_for_jekyll/emoji_generator'
@@ -0,0 +1,39 @@
1
+ module EmojiForJekyll
2
+ class EmojiGenerator < Jekyll::Generator
3
+ def initialize(config)
4
+ warn_deprecated_config(config)
5
+
6
+ @site_config = config
7
+ end
8
+
9
+ def generate(site)
10
+ # TODO What 'bout collections?
11
+ (site.pages + site.posts).each do |item|
12
+ Emojifier.new(item, config.merge(site_source: site.source)).emojify
13
+ end
14
+ end
15
+
16
+ private
17
+ def warn_deprecated_config(config)
18
+ deprecated_keys_used = %w(emoji-whitelist emoji-blacklist emoji-additional-keys emoji-images-path).select do |key|
19
+ config.has_key?(key)
20
+ end
21
+
22
+ if deprecated_keys_used.any?
23
+ Jekyll.logger.warn "Deprecation (Emoji for Jekyll):", "Deprecated configuration keys are used. Please refer to the documentation (https://github.com/yihangho/emoji-for-jekyll) for more information."
24
+ end
25
+ end
26
+
27
+ def config
28
+ emoji_config = @site_config["emoji"] || {}
29
+
30
+ @config ||= {
31
+ enabled: !emoji_config.has_key?("enabled") || !!emoji_config["enabled"],
32
+ front_matter: Array(emoji_config["front_matter"]),
33
+ whitelist: emoji_config.has_key?("whitelist") ? Array(emoji_config["whitelist"]) : nil,
34
+ blacklist: emoji_config.has_key?("blacklist") ? Array(emoji_config["blacklist"]) : nil,
35
+ source: emoji_config["source"]
36
+ }
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,107 @@
1
+ require 'json'
2
+
3
+ module EmojiForJekyll
4
+ class Emojifier
5
+ REGEX = /:[\w\+\-]+:/
6
+
7
+ def initialize(document, base_config)
8
+ @document = document
9
+ @base_config = base_config
10
+ end
11
+
12
+ def emojify
13
+ return unless config[:enabled]
14
+
15
+ proc = Proc.new do |token|
16
+ stripped_token = token[1..-2]
17
+ if emoji_allowed?(stripped_token) && emoji_exists?(stripped_token)
18
+ image_tag(stripped_token)
19
+ else
20
+ token
21
+ end
22
+ end
23
+
24
+ @document.content.gsub!(REGEX, &proc)
25
+ config[:front_matter].each do |key|
26
+ next unless @document.data.has_key?(key)
27
+ @document.data[key].gsub!(REGEX, &proc)
28
+ end
29
+ end
30
+
31
+ private
32
+ def config
33
+ return @config if @config
34
+
35
+ @config = @base_config.clone
36
+ return @config unless @document.data.has_key?("emoji")
37
+
38
+ if @document.data["emoji"].has_key?("enabled")
39
+ @config[:enabled] = !!@document.data["emoji"]["enabled"]
40
+ end
41
+
42
+ if @document.data["emoji"]["front_matter"]
43
+ @config[:front_matter] = Array(@document.data["emoji"]["front_matter"])
44
+ end
45
+
46
+ if @document.data["emoji"].has_key?("source")
47
+ @config[:source] = @document.data["emoji"]["source"]
48
+ end
49
+
50
+ if @document.data["emoji"].has_key?("whitelist") && @document.data["emoji"].has_key?("blacklist")
51
+ @config[:whitelist] = @document.data["emoji"]["whitelist"].nil? ? nil : Array(@document.data["emoji"]["whitelist"])
52
+ @config[:blacklist] = @document.data["emoji"]["blacklist"].nil? ? nil : Array(@document.data["emoji"]["blacklist"])
53
+ elsif @document.data["emoji"].has_key?("whitelist")
54
+ @config[:whitelist] = @document.data["emoji"]["whitelist"].nil? ? nil : Array(@document.data["emoji"]["whitelist"])
55
+ @config[:blacklist] = nil unless @document.data["emoji"]["whitelist"].nil?
56
+ elsif @document.data["emoji"].has_key?("blacklist")
57
+ @config[:blacklist] = @document.data["emoji"]["blacklist"].nil? ? nil : Array(@document.data["emoji"]["blacklist"])
58
+ @config[:whitelist] = nil unless @document.data["emoji"]["blacklist"].nil?
59
+ end
60
+
61
+ @config
62
+ end
63
+
64
+ def default_emoji
65
+ @default_emoji ||= Set.new(JSON.parse(IO.readlines(File.expand_path("emoji.json", File.dirname(File.dirname(__FILE__)))).join))
66
+ end
67
+
68
+ def custom_emoji
69
+ @custom_emoji ||= {}
70
+ return {} unless config[:source]
71
+ source = File.join(config[:site_source], config[:source])
72
+ return @custom_emoji[source] if @custom_emoji.has_key?(source)
73
+
74
+ pairs = Dir.foreach(source).select do |filename|
75
+ %w(svg png jpg jpeg gif).include? File.extname(filename).downcase[1..-1]
76
+ end.map do |filename|
77
+ [File.basename(filename, File.extname(filename)).downcase, File.join("/", config[:source], filename)]
78
+ end
79
+
80
+ @custom_emoji[source] = Hash[pairs].freeze
81
+ end
82
+
83
+ def emoji_allowed?(emoji)
84
+ if config[:whitelist]
85
+ config[:whitelist].include?(emoji)
86
+ elsif config[:blacklist]
87
+ !config[:blacklist].include?(emoji)
88
+ else
89
+ true
90
+ end
91
+ end
92
+
93
+ def emoji_exists?(emoji)
94
+ custom_emoji.include?(emoji) || default_emoji.include?(emoji)
95
+ end
96
+
97
+ def image_tag(emoji)
98
+ if custom_emoji.include?(emoji)
99
+ image_source = custom_emoji[emoji]
100
+ else
101
+ image_source = "https://github.global.ssl.fastly.net/images/icons/emoji/#{emoji}.png"
102
+ end
103
+
104
+ "<img class='emoji' title='#{emoji}' alt='#{emoji}' src='#{image_source}' height='20' width='20' align='absmiddle'>"
105
+ end
106
+ end
107
+ end
metadata CHANGED
@@ -1,15 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emoji_for_jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yihang Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: safe_yaml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-progressbar
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
13
69
  description: A plugin for Jekyll that seamlessly enable emoji.
14
70
  email: me@yihangho.com
15
71
  executables: []
@@ -22,6 +78,8 @@ files:
22
78
  - README.md
23
79
  - lib/emoji.json
24
80
  - lib/emoji_for_jekyll.rb
81
+ - lib/emoji_for_jekyll/emoji_generator.rb
82
+ - lib/emoji_for_jekyll/emojifier.rb
25
83
  homepage: https://github.com/yihangho/emoji-for-jekyll
26
84
  licenses:
27
85
  - MIT
@@ -38,12 +96,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
38
96
  version: '0'
39
97
  required_rubygems_version: !ruby/object:Gem::Requirement
40
98
  requirements:
41
- - - ">="
99
+ - - ">"
42
100
  - !ruby/object:Gem::Version
43
- version: '0'
101
+ version: 1.3.1
44
102
  requirements: []
45
103
  rubyforge_project:
46
- rubygems_version: 2.5.1
104
+ rubygems_version: 2.4.5
47
105
  signing_key:
48
106
  specification_version: 4
49
107
  summary: Seamlessly enable emoji in Jekyll.