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:
parent
85d3b16c68
commit
043174f418
3 changed files with 122 additions and 102 deletions
|
@ -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 }}
|
||||
`,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue