mirror of
https://github.com/discourse/discourse.git
synced 2025-08-21 19:11:18 +08:00
FIX: Emoji in Discourse onebox is wrapped in square brackets.
This commit is contained in:
parent
365301fb23
commit
a362ad9407
5 changed files with 19 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue