Last active
          August 29, 2015 14:03 
        
      - 
      
 - 
        
Save frankie-loves-jesus/2a0ab7920b1e232a557d to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def forem_emojify(content) | |
| h(content).to_str | |
| # Convert regular emoticons | |
| .gsub(' :)', ' :smile:') | |
| .gsub(' ;)', ' :wink:') | |
| .gsub(' :D', ' :laughing:') | |
| .gsub(' :P', ' :stuck_out_tongue:') | |
| .gsub(' :p', ' :stuck_out_tongue:') | |
| .gsub(' :O', ' :open_mouth:') | |
| .gsub(' :o', ' :open_mouth:') | |
| .gsub(' :|', ' :expressionless:') | |
| .gsub(' :/', ' :disappointed:') | |
| .gsub(' :(', ' :disappointed:') | |
| # Match emojis | |
| .gsub(/:([a-z0-9\+\-_]+):/) do |match| | |
| if Emoji.names.include?($1) | |
| '<img alt="' + $1 + '" height="20" src="' + asset_path("emoji/#{$1}.png") + '" style="vertical-align:middle" width="20" />' | |
| else | |
| match | |
| end | |
| end.html_safe if content.present? | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment