emoji

package module
v0.0.0-...-d15b69a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2015 License: MIT Imports: 5 Imported by: 0

README

emoji

Build Status GoDoc

A golang library for emoji chars converting.

INSTALL

$ go get -u github.com/chnlr/emoji

EXAMPLE CODE

package main

import (
    "fmt"

    "github.com/chnlr/emoji"
)

func main() {
    fmt.Println(emoji.EmojiTagToUnicode(`:+1:`)) // => 👍
}

DOCUMENTATION

Author

Naoki OKAMURA a.k.a nyarla nyarla@thotep.net

LICENSE

MIT

USGIN LIBRARIES

  1. map.go in this package is base by https://github.com/melborne/emot/blob/master/lib/emot/map.rb (ruby's emot)
    • ruby's emot is under the MIT
    • Copyright (c) 2014 kyoendo.
  2. this library is using to twemoji's SVG link with MaxCDN for generates emoji image link.

Documentation

Overview

Package emoji is a emoji chars converter for golang.

This package is using Twemoji SVG link with MaxCDN (http://twemoji.maxcdn.com/) by some func, and this charactar map is based by ruby's emot (https://github.com/melborne/emot).

Twemoji Graphics Images is under the CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/ <Copyright (c) 2014 Twitter, Inc and other contributors>
ruby's emot is under the MIT: https://github.com/melborne/emot/blob/master/LICENSE.txt <Copyright (c) 2014 kyoendo>

Index

Constants

View Source
const (
	TwemojiHTMLTemplate  = `<img src="%s" width="%d" height="%d" >`
	TwemojiXHTMLTemplate = `<img src="%s" width="%d" height="%d" />`
)

Variables

This section is empty.

Functions

func EmojiTagToHTMLEntities

func EmojiTagToHTMLEntities(src string) string

EmojiTagToHTMLEntities is replacing emoji tag to html entities of emoji unicode.

For example: :+1: => &#x1F44D;

func EmojiTagToTwemoji

func EmojiTagToTwemoji(src string, size int, isXHTML bool) string

EmojiTagToTwemoji is replace emoji tag to twemoji's SVG link with MaxCDN.

Arguments:
  - src  (string) : source string
  - size (int)    : html img tag's height and width valu
  - isXHTML (bool): output is XHTML (true) or HTML (false)

For Example: :+1: => <img src="//twemoji.maxcdn.com/svg/1f44d.svg" width="16" height="16" />

func EmojiTagToUnicode

func EmojiTagToUnicode(src string) string

EmojiTagToUnicode is replacing emoji tag to unicode chars.

For example: :+1: => rune(0x1F44D)

func HTMLEntitiesToUnicode

func HTMLEntitiesToUnicode(src string) string

HTMLEntitiesToUnicode is replacing html entities of emoji unicode to unicode chars.

For Example: &#x1F44D; => rune(0x1F44D)

func UnicodeToEmojiTag

func UnicodeToEmojiTag(src string) string

UnicodeToEmojiTag is replacing emoji tag to unicode chars.

For example: rune(0x1F44D) => :+1:

func UnicodeToHTMLEntities

func UnicodeToHTMLEntities(src string) string

UnicodeToHTMLEntities is replacing unicode emoji chars to html entities.

For Example: rune(0x1F44D) => &#x1F44D;

func UnicodeToTwemoji

func UnicodeToTwemoji(src string, size int, isXHTML bool) string

UnicodeToTwemoji is replacing unicode emoji chars to twemoji's SVG link with MaxCDN.

Arguments:
  - src  (string) : source string
  - size (int)    : html img tag's height and width valu
  - isXHTML (bool): output is XHTML (true) or HTML (false)

For Example: rune(0x1F44D) => <img src="//twemoji.maxcdn.com/svg/1f44d.svg" width="16" height="16" />

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL