diff --git a/kernel/go.mod b/kernel/go.mod index e8ebdf291..9986e9f05 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -7,7 +7,7 @@ require ( github.com/88250/css v0.1.2 github.com/88250/flock v0.8.2 github.com/88250/gulu v1.2.3-0.20220720144315-065ef35ec583 - github.com/88250/lute v1.7.5-0.20220727143137-4554c97d2e0e + github.com/88250/lute v1.7.5-0.20220728154341-bb906394d19e github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1 github.com/88250/pdfcpu v0.3.13 github.com/88250/protyle v0.0.0-20220519012506-0a2c8dc24397 diff --git a/kernel/go.sum b/kernel/go.sum index be327f7a4..b9fe4e453 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -58,8 +58,8 @@ github.com/88250/gulu v1.2.0/go.mod h1:ZhEJ98UjR2y7j2toGj4/b+1rRELcZFQAPq/Yjyin2 github.com/88250/gulu v1.2.3-0.20220720144315-065ef35ec583 h1:FhA/zJemLrbOYJpdMIMBezO5rGigQSdPR1kv+aztHfA= github.com/88250/gulu v1.2.3-0.20220720144315-065ef35ec583/go.mod h1:I1qBzsksFL2ciGSuqDE7R3XW4BUMrfDgOvSXEk7FsAI= github.com/88250/lute v1.7.4-0.20220426011157-34c9bfa2e148/go.mod h1:Bdu9LRNjQhtL3TftbtpjIWTwDVAXoS7AD8QsZQPk7zo= -github.com/88250/lute v1.7.5-0.20220727143137-4554c97d2e0e h1:RsAEtEMRUWE3PDBNIqNKp7UfUvlvFP1pSiWbDEYmxIo= -github.com/88250/lute v1.7.5-0.20220727143137-4554c97d2e0e/go.mod h1:Bdu9LRNjQhtL3TftbtpjIWTwDVAXoS7AD8QsZQPk7zo= +github.com/88250/lute v1.7.5-0.20220728154341-bb906394d19e h1:cfFgpeJOTch5bJvRn8H8ysE2zNBJNo3tZFP9GpUmQvM= +github.com/88250/lute v1.7.5-0.20220728154341-bb906394d19e/go.mod h1:Bdu9LRNjQhtL3TftbtpjIWTwDVAXoS7AD8QsZQPk7zo= github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1 h1:9Cb+iN639vUI2OcIBc+4oGwml9/0J6bL6dWNb8Al+1s= github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1/go.mod h1:jH6MMPr8G7AMzaVmWHXZQiB1DKO3giWbcWZ7UoJ1teI= github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q= diff --git a/kernel/model/export.go b/kernel/model/export.go index e56b15208..6be4a96b1 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -249,6 +249,14 @@ func ExportMarkdownHTML(id, savePath string, docx bool) (name, dom string) { } } + // 复制自定义表情图片 + from := filepath.Join(util.DataDir, "emojis") + to := filepath.Join(savePath, "emojis") + if err := gulu.File.Copy(from, to); nil != err { + logging.LogErrorf("copy emojis from [%s] to [%s] failed: %s", from, savePath, err) + return + } + luteEngine := NewLute() luteEngine.SetFootnotes(true) md := treenode.FormatNode(tree.Root, luteEngine) @@ -331,6 +339,14 @@ func ExportHTML(id, savePath string, pdf bool) (name, dom string) { return } } + + // 复制自定义表情图片 + from := filepath.Join(util.DataDir, "emojis") + to := filepath.Join(savePath, "emojis") + if err := gulu.File.Copy(from, to); nil != err { + logging.LogErrorf("copy emojis from [%s] to [%s] failed: %s", from, savePath, err) + return + } } else { // 导出 PDF 需要将资源文件路径改为 HTTP 伺服 luteEngine.RenderOptions.LinkBase = "http://127.0.0.1:" + util.ServerPort + "/" } diff --git a/kernel/model/sync.go b/kernel/model/sync.go index bc2646811..a7d646037 100644 --- a/kernel/model/sync.go +++ b/kernel/model/sync.go @@ -332,7 +332,7 @@ func formatErrorMsg(err error) string { msg = Conf.Language(172) + " " + err.Error() } else if strings.Contains(msgLowerCase, "repo fatal error") { msg = Conf.Language(23) + " " + err.Error() - } else if strings.Contains(msgLowerCase, "no such host") || strings.Contains(msgLowerCase, "connection failed") { + } else if strings.Contains(msgLowerCase, "no such host") || strings.Contains(msgLowerCase, "connection failed") || strings.Contains(msgLowerCase, "hostname resolution") { msg = Conf.Language(24) } else if strings.Contains(msgLowerCase, "net/http: request canceled while waiting for connection") || strings.Contains(msgLowerCase, "exceeded while awaiting") { msg = Conf.Language(24) + " net/http timeout"