mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: Emoji in Discourse onebox is wrapped in square brackets.
This commit is contained in:
@ -13,7 +13,8 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
||||
@text_entities = options[:text_entities] == true
|
||||
@markdown_images = options[:markdown_images] == true
|
||||
@keep_newlines = options[:keep_newlines] == true
|
||||
@keep_emojis = options[:keep_emojis] == true
|
||||
@keep_emoji_images = options[:keep_emoji_images] == true
|
||||
@keep_emoji_codes = options[:keep_emoji_codes] == true
|
||||
@start_excerpt = false
|
||||
end
|
||||
|
||||
@ -48,11 +49,14 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
||||
def start_element(name, attributes=[])
|
||||
case name
|
||||
when "img"
|
||||
|
||||
attributes = Hash[*attributes.flatten]
|
||||
|
||||
if @keep_emojis && attributes["class"] == 'emoji'
|
||||
return include_tag(name, attributes)
|
||||
if attributes["class"] == 'emoji'
|
||||
if @keep_emoji_images
|
||||
return include_tag(name, attributes)
|
||||
elsif @keep_emoji_codes
|
||||
return characters(attributes["alt"])
|
||||
end
|
||||
end
|
||||
|
||||
# If include_images is set, include the image in markdown
|
||||
|
Reference in New Issue
Block a user