mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Improve exporting HTML/Word
This commit is contained in:
parent
776b4fd6ee
commit
b5bfbbe14a
4 changed files with 32 additions and 3 deletions
|
|
@ -17,10 +17,13 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"unicode"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
||||
func ContainsCJK(text string) bool {
|
||||
|
|
@ -65,3 +68,29 @@ func RemoveInvalid(text string) (ret string) {
|
|||
ret = gulu.Str.RemovePUA(ret)
|
||||
return
|
||||
}
|
||||
|
||||
var NativeEmojiChars = map[string]bool{}
|
||||
|
||||
func InitEmojiChars() {
|
||||
builtConfPath := filepath.Join(AppearancePath, "emojis", "conf.json")
|
||||
data, err := os.ReadFile(builtConfPath)
|
||||
if err != nil {
|
||||
logging.LogErrorf("read emojis conf.json failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
var conf []map[string]interface{}
|
||||
if err = gulu.JSON.UnmarshalJSON(data, &conf); err != nil {
|
||||
logging.LogErrorf("unmarshal emojis conf.json failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, emoji := range conf {
|
||||
items := emoji["items"].([]interface{})
|
||||
for _, item := range items {
|
||||
e := item.(map[string]interface{})
|
||||
NativeEmojiChars[e["unicode"].(string)] = true
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue