FEATURE: do not replace ↔ with an emoji

↔ technically can be an emoji, but usually will not be used in that way
This commit is contained in:
Sam Saffron 2019-08-30 15:06:23 +10:00
parent dbd6c32914
commit e9cf0de588
3 changed files with 8 additions and 16 deletions

View File

@ -149,9 +149,10 @@ class Emoji
name = e['name']
# special cased as we prefer to keep these as symbols
next if name == 'registered'.freeze
next if name == 'copyright'.freeze
next if name == 'tm'.freeze
next if name == 'registered'
next if name == 'copyright'
next if name == 'tm'
next if name == 'left_right_arrow'
code = replacement_code(e['code'])
next unless code

View File

@ -187,19 +187,6 @@ module PrettyText
baked = context.eval("__pt.cook(#{text.inspect})")
end
# if baked.blank? && !(opts || {})[:skip_blank_test]
# # we may have a js engine issue
# test = markdown("a", skip_blank_test: true)
# if test.blank?
# Rails.logger.warn("Markdown engine appears to have crashed, resetting context")
# reset_context
# opts ||= {}
# opts = opts.dup
# opts[:skip_blank_test] = true
# baked = markdown(text, opts)
# end
# end
baked
end

View File

@ -869,6 +869,10 @@ describe PrettyText do
expect(PrettyText.cook("💣")).to match(/\:bomb\:/)
end
it "does not replace left right arrow" do
expect(PrettyText.cook("&harr;")).to eq('<p>↔</p>')
end
it "doesn't replace emoji in inline code blocks with our emoji sets if emoji is enabled" do
expect(PrettyText.cook("`💣`")).not_to match(/\:bomb\:/)
end