Suggestion in markdown format of emoji that can be used on github? A shit-like script that creates a dictionary file If you import the created file in the settings and convert it with "Eji", you will get an emoji that can be used on github like: hoge :.
http://www.emoji-cheat-sheet.com I'm bringing an emoji from.
create_emoji_dictionary.sh
#!/bin/sh
EMOJI_DIR=/tmp/emoji_`date +"%Y%m%d_%H%M%S"`
mkdir -p $EMOJI_DIR
python emoji_to_dic.py > $EMOJI_DIR/mardkdown_utf8.txt
iconv -f utf-8 -t utf-16 $EMOJI_DIR/mardkdown_utf8.txt > $EMOJI_DIR/mardkdown.txt
open $EMOJI_DIR
emoji_to_dic.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import codecs
import sys
import urllib
from HTMLParser import HTMLParser
'''
Fixed variables
'''
url = 'http://www.emoji-cheat-sheet.com/'
'''
Parser
'''
class EmojiParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.isToken = False
self.token = ''
'''
' Find software version tag.
'''
def handle_starttag(self, tag, attrs):
self.isToken = False
attrs = dict(attrs)
if tag != 'span':
return
if 'class' not in attrs:
return
if attrs['class'] != 'name':
return
self.isToken = True
'''
' Extraction version data.
'''
def handle_data(self, data):
data = data.strip('\ \n:')
if not self.isToken:
return
if not data:
return
print u'"Eji",":' + data + u':","Appellative"'
def GetParser():
return EmojiParser()
'''
Main.
'''
if __name__ == "__main__":
parser = GetParser()
if not parser:
print 'none parser.'
sys.exit(1)
sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
parser.feed(urllib.urlopen(url).read())
Recommended Posts