From cafb784799e2e09df7345ca1d7cfcfae4d1b7aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 25 Feb 2016 00:52:11 +0100 Subject: 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 --- commands/hugo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/hugo.go b/commands/hugo.go index dd3ca289e..7ecf6d7c3 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -1,4 +1,4 @@ -// Copyright 2015 The Hugo Authors. All rights reserved. +// Copyright 2016 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -301,6 +301,7 @@ func LoadDefaultSettings() { viper.SetDefault("SectionPagesMenu", "") viper.SetDefault("DisablePathToLower", false) viper.SetDefault("HasCJKLanguage", false) + viper.SetDefault("EnableEmoji", false) } // InitializeConfig initializes a config file with sensible default configuration flags. -- cgit v1.2.3