Commit Graph

12 Commits

Author SHA1 Message Date
Cameron Moore 1f7e9f7333 Update emoji import paths and version
Since emoji is v2, we must import it with the `/v2` suffix.  Doing so
allows the Go tools to detect the latest release.
2020-12-30 22:46:19 +01:00
Bjørn Erik Pedersen d90e37e0c6 all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
2020-12-03 13:12:58 +01:00
Bjørn Erik Pedersen b5f39d23b8 all: Apply staticcheck recommendations 2019-03-24 16:14:51 +01:00
Bjørn Erik Pedersen 873a6f1885 Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
Bjørn Erik Pedersen d8717cd4c7 all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
Cameron Moore b6635e1baf helpers: Fix bug in emoji renderer
Fixes #2391
2016-08-30 00:34:48 +02:00
Bjørn Erik Pedersen 6c0f705217 Fix Emoji benchmark
The Emoji implementations gives slightly different output. One of them pads with a space.
2016-07-01 17:59:39 +02:00
Bjørn Erik Pedersen aa66478c20 Add Emoji test case
See #2246
2016-07-01 17:06:13 +02:00
Bjørn Erik Pedersen 2564f46a68 Fix Emojfy for certain text patterns
Fixes #2198
2016-06-11 20:40:56 +02:00
Bjørn Erik Pedersen 26906d8569 Don't add any space around Emojis 2016-05-09 22:59:49 +02:00
digitalcraftsman 5d3705df16 helpers: Apply GoLint rules 2016-03-24 23:16:18 +01:00
Bjørn Erik Pedersen cafb784799 Add emoji support
This uses the Emoji map from https://github.com/kyokomi/emoji -- but with a custom replacement implementation.

The built-in are fine for most use cases, but in Hugo we do care about pure speed.

The benchmarks below are skewed in Hugo's direction as the source and result is a byte slice,
Kyokomi's implementation works best with strings.

Curious: The easy-to-use `strings.Replacer` is also plenty fast.

```
BenchmarkEmojiKyokomiFprint-4  	   20000	     86038 ns/op	   33960 B/op	     117 allocs/op
BenchmarkEmojiKyokomiSprint-4  	   20000	     83252 ns/op	   38232 B/op	     122 allocs/op
BenchmarkEmojiStringsReplacer-4	  100000	     21092 ns/op	   17248 B/op	      25 allocs/op
BenchmarkHugoEmoji-4           	  500000	      5728 ns/op	     624 B/op	      13 allocs/op
```

Fixes #1891
2016-03-11 15:51:37 -06:00