From a5e1b569be3660cfefd17cd81f5683d595e2f9af Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 11 Jul 2024 20:37:06 +0800 Subject: [PATCH] refactor: Add default BuildContext if none provided in TranslateMarks function --- sui/core/compile.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sui/core/compile.go b/sui/core/compile.go index 27a67fae..0dbfe851 100644 --- a/sui/core/compile.go +++ b/sui/core/compile.go @@ -290,6 +290,10 @@ func (page *Page) TranslateMarks(ctx *BuildContext, option *BuildOption, doc *go return nil } + if ctx == nil { + ctx = NewBuildContext(nil) + } + if ctx.translations == nil { ctx.translations = []Translation{} }