mumukit-content-type 1.0.0 → 1.1.0

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: 226e2611364d46092d07b57e14b7b13048da084d
4
- data.tar.gz: 0c5884c7360699613bc1d0bfb270c85cb9b32253
3
+ metadata.gz: 117bd7dd214c2a5c756dbf6c99a2078f6faa896e
4
+ data.tar.gz: 6aaed94c62cddba28c8a135a6fe1bb9e34c7f384
5
5
  SHA512:
6
- metadata.gz: 840d640afcc163437c083f29ac57ed9e19e2c431a873b8e522633e38bba82ecb5291685d319cbd16f8559f35e0b18d7ee9c69235196d60055a9385fab7997efe
7
- data.tar.gz: e355da778d45611525190a60d5df2e75918c7d042cdb8ff3c4a80364d751a7bfaa7a478f34d9aaf92d3c3830a108f6a4bf82c5887b402c4d9cc5e36d34866b4e
6
+ metadata.gz: 39c8c25471f57580782ed118483ba7e8eb03ec0600fe5b308bab4a3dbb2f62e5780c16b3a7f323a3bb61034f2ad7e71993f2747a1e647668aeeef77b68f52e16
7
+ data.tar.gz: 1fa95eaa20bc17d35a3afd29d74b8e0409e678e7c473648220f16ef502bb5f02f581b73e1887e2a292ee50c4fd0db9d032e0df06d0f7868cf0ec89bddcc700fb
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rouge', git: 'https://github.com/mumuki/rouge', branch: 'master'
4
-
5
3
  gemspec
data/README.md CHANGED
@@ -16,8 +16,9 @@ Those classes allow to both render code and arbitrary text
16
16
 
17
17
  Bug reports and pull requests are welcome on GitHub at https://github.com/mumukit-content-type/mumukit-content-type-content-type. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
18
18
 
19
-
20
19
  ## License
21
20
 
22
21
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
23
22
 
23
+ This software also contains MIT code by Jordan Byron, extracted from
24
+ https://github.com/elm-city-craftworks/md_emoji
@@ -1,4 +1,5 @@
1
1
  require 'mumukit/core'
2
+ require 'redcarpet'
2
3
 
3
4
  module Mumukit
4
5
  module ContentType
@@ -20,6 +21,7 @@ module Mumukit
20
21
  end
21
22
  end
22
23
 
24
+ require_relative './content_type/md_emoji'
23
25
  require_relative './content_type/markdown'
24
26
  require_relative './content_type/with_markdown'
25
27
  require_relative './content_type/plain'
@@ -1,4 +1,3 @@
1
- require 'md_emoji'
2
1
  require 'rouge'
3
2
  require 'redcarpet'
4
3
  require 'rouge/plugins/redcarpet'
@@ -0,0 +1,167 @@
1
+ #
2
+ # Notice: This file was extracted from https://github.com/elm-city-craftworks/md_emoji
3
+ #
4
+ ##
5
+ ## Copyright (c) 2011 Jordan Byron
6
+ ##
7
+ ## Permission is hereby granted, free of charge, to any person obtaining a copy of this software
8
+ ## and associated documentation files (the "Software"), to deal in the Software without restriction,
9
+ ## including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ ## and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
11
+ ## subject to the following conditions:
12
+ ##
13
+ ## The above copyright notice and this permission notice shall be included in all copies or substantial
14
+ ## portions of the Software.
15
+ ##
16
+ ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
17
+ ## NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ ## IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19
+ ## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
20
+ ## THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ module MdEmoji
23
+ EMOJI = %w{+1 -1 0 1 100 109 1234 2 3 4 5 6 7 8 8ball 9 a ab
24
+ abc abcd accept aerial_tramway airplane alarm_clock alien ambulance
25
+ anchor angel anger angry anguished ant apple aquarius aries arrow_backward
26
+ arrow_double_down arrow_double_up arrow_down arrow_down_small arrow_forward
27
+ arrow_heading_down arrow_heading_up arrow_left arrow_lower_left arrow_lower_right
28
+ arrow_right arrow_right_hook arrow_up arrow_up_down arrow_up_small arrow_upper_left
29
+ arrow_upper_right arrows_clockwise arrows_counterclockwise art articulated_lorry
30
+ astonished atm b baby baby_bottle baby_chick baby_symbol baggage_claim balloon
31
+ ballot_box_with_check bamboo banana bangbang bank bar_chart barber baseball
32
+ basketball bath bathtub battery bear beer beers beetle beginner bell bento
33
+ bicyclist bike bikini bird birthday black_circle black_joker black_nib black_square
34
+ black_square_button blossom blowfish blue_book blue_car blue_heart blush boar
35
+ boat bomb book bookmark bookmark_tabs books boom boot bouquet bow bowling bowtie
36
+ boy bread bride_with_veil bridge_at_night briefcase broken_heart bug bulb bullettrain_front
37
+ bullettrain_side bus busstop bust_in_silhouette busts_in_silhouette cactus cake calendar
38
+ calling camel camera cancer candy capital_abcd capricorn car card_index carousel_horse
39
+ cat cat2 cd chart chart_with_downwards_trend chart_with_upwards_trend checkered_flag
40
+ cherries cherry_blossom chestnut chicken children_crossing chocolate_bar christmas_tree
41
+ church cinema circus_tent city_sunrise city_sunset cl clap clapper clipboard clock1 clock10
42
+ clock1030 clock11 clock1130 clock12 clock1230 clock130 clock2 clock230 clock3 clock330
43
+ clock4 clock430 clock5 clock530 clock6 clock630 clock7 clock730 clock8 clock830 clock9
44
+ clock930 closed_book closed_lock_with_key closed_umbrella cloud clubs cn cocktail coffee
45
+ cold_sweat collision computer confetti_ball confounded confused congratulations construction
46
+ construction_worker convenience_store cookie cool cop copyright corn couple couple_with_heart
47
+ couplekiss cow cow2 credit_card crocodile crossed_flags crown cry crying_cat_face crystal_ball
48
+ cupid curly_loop currency_exchange curry custard customs cyclone dancer dancers dango dart dash
49
+ date de deciduous_tree department_store diamond_shape_with_a_dot_inside diamonds disappointed
50
+ disappointed_relieved dizzy dizzy_face do_not_litter dog dog2 dollar dolls dolphin door doughnut
51
+ dragon dragon_face dress dromedary_camel droplet dvd e-mail ear ear_of_rice earth_africa
52
+ earth_americas earth_asia egg eggplant egplant eight eight_pointed_black_star eight_spoked_asterisk
53
+ electric_plug elephant email end envelope es euro european_castle european_post_office
54
+ evergreen_tree exclamation expressionless eyeglasses eyes facepunch factory fallen_leaf family
55
+ fast_forward fax fearful feelsgood feet ferris_wheel file_folder finnadie fire fire_engine
56
+ fireworks first_quarter_moon first_quarter_moon_with_face fish fish_cake
57
+ fishing_pole_and_fish fist five flags flashlight floppy_disk flower_playing_cards
58
+ flushed foggy football fork_and_knife fountain four four_leaf_clover fr free fried_shrimp
59
+ fries frog frowning fu fuelpump full_moon full_moon_with_face game_die gb gem gemini ghost
60
+ gift gift_heart girl globe_with_meridians goat goberserk godmode golf grapes green_apple
61
+ green_book green_heart grey_exclamation grey_question grimacing grin grinning guardsman
62
+ guitar gun haircut hamburger hammer hamster hand handbag hankey hash hatched_chick hatching_chick
63
+ headphones hear_no_evil heart heart_decoration heart_eyes heart_eyes_cat heartbeat heartpulse
64
+ hearts heavy_check_mark heavy_division_sign heavy_dollar_sign heavy_exclamation_mark
65
+ heavy_minus_sign heavy_multiplication_x heavy_plus_sign helicopter herb hibiscus high_brightness
66
+ high_heel hocho honey_pot honeybee horse horse_racing hospital hotel hotsprings hourglass
67
+ hourglass_flowing_sand house house_with_garden hurtrealbad hushed ice_cream icecream id ideograph_advantage imp
68
+ inbox_tray incoming_envelope information_desk_person information_source innocent interrobang
69
+ iphone it izakaya_lantern jack_o_lantern japan japanese_castle japanese_goblin japanese_ogre
70
+ jeans joy joy_cat jp key keycap_ten kimono kiss kissing kissing_cat kissing_closed_eyes kissing_face
71
+ kissing_heart kissing_smiling_eyes koala koko kr large_blue_circle large_blue_diamond
72
+ large_orange_diamond last_quarter_moon last_quarter_moon_with_face laughing leaves ledger
73
+ left_luggage left_right_arrow leftwards_arrow_with_hook lemon leo leopard libra light_rail
74
+ link lips lipstick lock lock_with_ink_pen lollipop loop loudspeaker love_hotel love_letter
75
+ low_brightness m mag mag_right mahjong mailbox mailbox_closed mailbox_with_mail mailbox_with_no_mail
76
+ man man_with_gua_pi_mao man_with_turban mans_shoe maple_leaf mask massage meat_on_bone mega melon
77
+ memo mens metal metro microphone microscope milky_way minibus minidisc mobile_phone_off money_with_wings
78
+ moneybag monkey monkey_face monorail moon mortar_board mount_fuji mountain_bicyclist mountain_cableway
79
+ mountain_railway mouse mouse2 movie_camera moyai muscle mushroom musical_keyboard musical_note
80
+ musical_score mute nail_care name_badge neckbeard necktie negative_squared_cross_mark neutral_face
81
+ new new_moon new_moon_with_face newspaper ng nine no_bell no_bicycles no_entry no_entry_sign no_good
82
+ no_mobile_phones no_mouth no_pedestrians no_smoking non-potable_water nose notebook
83
+ notebook_with_decorative_cover notes nut_and_bolt o o2 ocean octocat octopus oden office ok ok_hand
84
+ ok_woman older_man older_woman on oncoming_automobile oncoming_bus oncoming_police_car oncoming_taxi
85
+ one open_file_folder open_hands open_mouth ophiuchus orange_book outbox_tray ox page_facing_up
86
+ page_with_curl pager palm_tree panda_face paperclip parking part_alternation_mark partly_sunny
87
+ passport_control paw_prints peach pear pencil pencil2 penguin pensive performing_arts persevere
88
+ person_frowning person_with_blond_hair person_with_pouting_face phone pig pig2 pig_nose pill
89
+ pineapple pisces pizza plus1 point_down point_left point_right point_up point_up_2 police_car
90
+ poodle poop post_office postal_horn postbox potable_water pouch poultry_leg pound pouting_cat
91
+ pray princess punch purple_heart purse pushpin put_litter_in_its_place question rabbit rabbit2
92
+ racehorse radio radio_button rage rage1 rage2 rage3 rage4 railway_car rainbow raised_hand raised_hands
93
+ raising_hand ram ramen rat recycle red_car red_circle registered relaxed relieved repeat repeat_one
94
+ restroom revolving_hearts rewind ribbon rice rice_ball rice_cracker rice_scene ring rocket
95
+ roller_coaster rooster rose rotating_light round_pushpin rowboat ru rugby_football runner running
96
+ running_shirt_with_sash sa sagittarius sailboat sake sandal santa satellite satisfied saxophone
97
+ school school_satchel scissors scorpius scream scream_cat scroll seat secret see_no_evil
98
+ seedling seven shaved_ice sheep shell ship shipit shirt shit shoe shower signal_strength six
99
+ six_pointed_star ski skull sleeping sleepy slot_machine small_blue_diamond small_orange_diamond
100
+ small_red_triangle small_red_triangle_down smile smile_cat smiley smiley_cat smiling_imp smirk
101
+ smirk_cat smoking snail snake snowboarder snowflake snowman sob soccer soon sos sound space_invader
102
+ spades spaghetti sparkler sparkles sparkling_heart speak_no_evil speaker speech_balloon speedboat
103
+ squirrel star star2 stars station statue_of_liberty steam_locomotive stew straight_ruler strawberry
104
+ stuck_out_tongue stuck_out_tongue_closed_eyes stuck_out_tongue_winking_eye sun_with_face sunflower
105
+ sunglasses sunny sunrise sunrise_over_mountains surfer sushi suspect suspension_railway sweat
106
+ sweat_drops sweat_smile sweet_potato swimmer symbols syringe tada tanabata_tree tangerine taurus
107
+ taxi tea telephone telephone_receiver telescope tennis tent thought_balloon three thumbsdown
108
+ thumbsup ticket tiger tiger2 tired_face tm toilet tokyo_tower tomato tongue tongue2 top tophat
109
+ tractor traffic_light train train2 tram triangular_flag_on_post triangular_ruler trident triumph
110
+ trolleybus trollface trophy tropical_drink tropical_fish truck trumpet tshirt tulip turtle tv
111
+ twisted_rightwards_arrows two two_hearts two_men_holding_hands two_women_holding_hands
112
+ u5272 u5408 u55b6 u6307 u6708 u6709 u6e80 u7121 u7533 u7981 u7a7a uk umbrella unamused
113
+ underage unlock up us v vertical_traffic_light vhs vibration_mode video_camera video_game
114
+ violin virgo volcano vs walking waning_crescent_moon waning_gibbous_moon warning watch
115
+ water_buffalo watermelon wave wavy_dash waxing_crescent_moon waxing_gibbous_moon wc weary
116
+ wedding whale whale2 wheelchair white_check_mark white_circle white_flower white_square
117
+ white_square_button wind_chime wine_glass wink wink2 wolf woman womans_clothes womans_hat
118
+ womens worried wrench x yellow_heart yen yum zap zero zzz}
119
+ end
120
+
121
+
122
+ module MdEmoji
123
+ class Render < Redcarpet::Render::HTML
124
+ def initialize(options={})
125
+ @options = options.merge(:no_intra_emphasis => true)
126
+ super @options
127
+ end
128
+
129
+ def paragraph(text)
130
+ text.gsub!("\n", "<br>\n") if @options[:hard_wrap]
131
+
132
+ "<p>#{replace_emoji(text)}</p>\n"
133
+ end
134
+
135
+ def list_item(text, list_type)
136
+ "<li>#{replace_emoji(text)}</li>"
137
+ end
138
+
139
+ # Replaces valid emoji characters, ie :smile:, with img tags
140
+ #
141
+ # Valid emoji charaters are listed in +MdEmoji::EMOJI+
142
+ def replace_emoji(text)
143
+ text.gsub(/:([^\s:])+:/) do |emoji|
144
+
145
+ emoji_code = emoji #.gsub("|", "_")
146
+ emoji = emoji_code.gsub(":", "")
147
+
148
+ if MdEmoji::EMOJI.include?(emoji)
149
+ file_name = "#{emoji.gsub('+', 'plus')}.png"
150
+ default_size = %{height="20" width="20"}
151
+
152
+ %{<img src="/assets/emojis/#{file_name}" class="emoji" } +
153
+ %{title="#{emoji_code}" alt="#{emoji_code}" #{default_size}>}
154
+ else
155
+ emoji_code
156
+ end
157
+ end
158
+ end
159
+
160
+ private
161
+
162
+ # Returns +true+ if emoji are present in +text+, otherwise returns +false+
163
+ def include_emoji?(text)
164
+ text && text[/:\S+:/]
165
+ end
166
+ end
167
+ end
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module ContentType
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'rake', '~> 10.0'
29
29
  spec.add_development_dependency 'rspec', '~>2.9'
30
30
 
31
+ spec.add_dependency 'rouge'
31
32
  spec.add_dependency 'redcarpet', '~> 3.3.2'
32
- spec.add_dependency 'md_emoji'
33
33
  spec.add_dependency 'mumukit-core', '~> 1.0'
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-content-type
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-28 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,33 +53,33 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.9'
55
55
  - !ruby/object:Gem::Dependency
56
- name: redcarpet
56
+ name: rouge
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.3.2
61
+ version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.3.2
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: md_emoji
70
+ name: redcarpet
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 3.3.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 3.3.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mumukit-core
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +115,7 @@ files:
115
115
  - lib/mumukit/content_type.rb
116
116
  - lib/mumukit/content_type/html.rb
117
117
  - lib/mumukit/content_type/markdown.rb
118
+ - lib/mumukit/content_type/md_emoji.rb
118
119
  - lib/mumukit/content_type/plain.rb
119
120
  - lib/mumukit/content_type/version.rb
120
121
  - lib/mumukit/content_type/with_markdown.rb