Twemoji RubyGem

Twemoji RubyGem

Introduce Twemoji RubyGem @ Asakusa.rb
19 May 2015

771951f55ed37335f238e1a80dfda9cd?s=128

Juanito Fatas

May 19, 2015
Tweet

Transcript

  1. 6YGOQLK

  2. ,WCPKVQ(CVCU !

  3. @JuanitoFatas

  4. @JuanitoFatas

  5. @JuanitoFatas

  6. @JuanitoFatas

  7. Jolly Good Code !winstonyw

  8. None
  9. 闦闇闕阒陎阇阸閥陆

  10. 6YKVVGT'OQLK

  11. JVVRUVYGOQLKOCZEFPEQO

  12. None
  13. None
  14. JVVRUIKVJWDEQOLQNN[IQQFEQFGVYGOQLK

  15. 6YGOQLKRCTUGňJGCTVAG[GUʼn 6YGOQLKRCTUG KOI ENCUUŅGOQLK  FTCIICDNGŅHCNUG  VKVNGŅJGCTVAG[GU  CNVŅ

     UTEŅJVVRUVYGOQLKOCZEFPEQOZHFRPI   
  16. 20)ZZZ https://twemoji.maxcdn.com/72x72/1f60d.png https://twemoji.maxcdn.com/36x36/1f60d.png https://twemoji.maxcdn.com/16x16/1f60d.png

  17. 58)

  18. 6YGOQLKRCTUGQRVKQPU Twemoji.configure do |config| config.asset_root = "https://twemoji.awesomecdn.com/" config.file_ext = ".svg"

    config.image_size = nil # only png need to set size config.class_name = "twemoji" config.img_attr = "style='height: 1.3em;'" end
  19. #XCKNCDNGCU4CKNU*GNRGT module EmojiHelper def emojify(content, **options) return if content.blank? Twemoji.parse(h(content),

    options).html_safe end end
  20. '4DXKGY <%= emojify "I like chocolate :heart_eyes:!”, image_size: "36x36" %>

  21. $WVYGNKMG*CON %= emojify "I like chocolate :heart_eyes:!", image_size: "36x36"

  22. 1T*CONYKVJQWV UNKO  = emojify "I like chocolate :heart_eyes:!", image_size:

    "36x36" 5QTT[/CVUWFC閽闻
  23. *6/.2KRGNKPG JVVRUIKVJWDEQOLEJJVONRKRGNKPG

  24. %QPVGPV =/CTMFQYP(KNVGT? /CTMFQYP

  25. %JCKPQH(KNVGTU

  26. None
  27. ⬅️⬅️⬅️

  28. +PVGTITCVGYKVJ*6/.2KRGNKPG module HTML class Pipeline module Twitter class EmojiFilter <

    HTML::Pipeline::Filter def call Twemoji.parse(doc) end end end end end
  29. +PVGTITCVGYKVJ*6/.2KRGNKPG module MarkdownHelper def markdown_to_html(post, **options) pipeline = HTML::Pipeline.new [

    HTML::Pipeline::SanitizationFilter, HTML::Pipeline::Twitter::EmojiFilter, HTML::Pipeline::RougeFilter, ], { gfm: true, mentions: post.mentions, post: post, **options } pipeline.call(post.body)[:output].to_s.html_safe end end
  30. /C[6JG6YGOQLK $G9KVJ[QW

  31. 閼㖼㉦閬闇闈閵 閪闲閴闐閮閼閾閬闦闁猳

  32. #UCMWUCTD 磷涹