1
0
Fork 0
mirror of https://github.com/emojisum/emojisum.git synced 2025-07-16 13:50:27 +00:00

list: link unicode codepoint the full list

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-11-17 11:26:04 -05:00
parent 85d3b16c68
commit 043174f418
Signed by: vbatts
GPG key ID: 10937E57733F1362
3 changed files with 122 additions and 102 deletions

View file

@ -5,6 +5,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"os"
"text/template"
@ -35,8 +36,9 @@ func main() {
//mapGoTemp := template.Must(template.ParseFiles(*flTemplate))
funcMap := template.FuncMap{
"IsColonNotation": emoji.IsColonNotation,
"IsCodepoint": emoji.IsCodepoint,
"IsColonNotation": emoji.IsColonNotation,
"IsCodepoint": emoji.IsCodepoint,
"CodepointLinkMarkdown": codepointLinkMarkdown,
}
mapGoTemp, err := template.New("").Funcs(funcMap).Parse(tmpl[*flTemplate])
@ -48,6 +50,10 @@ func main() {
}
}
func codepointLinkMarkdown(word string) string {
return fmt.Sprintf(`[%s](%s)`, word, emoji.UnicodeLink(word))
}
var (
flInput = flag.String("in", "emojimap.json", "json input")
flOutput = flag.String("out", "map_gen.go", "golang output")
@ -91,7 +97,7 @@ To view the functional document, see [emojimap.json](./emojimap.json).
### List
{{- range $index, $words := .EmojiWords }}
* ` + "`{{ $index }}`" + ` -- {{ range $words }} {{- if IsColonNotation . -}} {{ . }} ` + "`{{ . }}`" + ` {{- else }} {{.}} {{- end }}{{- end }}
* ` + "`{{ $index }}`" + ` -- {{ range $words }} {{- if IsColonNotation . -}} {{ . }} ` + "`{{ . }}`" + ` {{- else }} {{ CodepointLinkMarkdown . }} {{- end }}{{- end }}
{{- end }}
`,
}