Skip to content

Commit

Permalink
Comment the import program and utility files
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdvs committed Jan 18, 2019
1 parent e91ad96 commit 280339f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
10 changes: 10 additions & 0 deletions import/main.go
@@ -1,5 +1,8 @@
package main

// Import emoji data from Emojipedia.org
// Useful for rebuilding the emoji data found in the `data/emoji.json` file

import (
"encoding/json"
"fmt"
Expand Down Expand Up @@ -71,23 +74,30 @@ func main() {
return
}

// Create a new goquery reader
doc, docErr := goquery.NewDocumentFromReader(res.Body)
if docErr != nil {
panic(docErr)
}

// Grab the emoji from the "Copy emoji" input field on the HTML page
emojiString, _ := doc.Find(".copy-paste input[type=text]").Attr("value")

// Convert the raw Emoji value to our hex key
hexString := utils.StringToHexKey(emojiString)

// Add this emoji to our map
emojis[hexString] = emoji.Emoji{
Key: hexString,
Value: emojiString,
Descriptor: lookup.Name,
}

// Print our progress to the console
fmt.Println(emojis[hexString])
}

// Marshal the emojis map as JSON and write to the data directory
s, _ := json.MarshalIndent(emojis, "", "\t")
ioutil.WriteFile("data/emoji.json", []byte(s), 0644)
}
1 change: 1 addition & 0 deletions utils/conv.go
@@ -1,3 +1,4 @@
// Package utils - Functions for converting between Hex, String, and Rune representations of emoji
package utils

import (
Expand Down
26 changes: 0 additions & 26 deletions utils/rebuild.go

This file was deleted.

0 comments on commit 280339f

Please sign in to comment.