Skip to content

Commit 93c5c41

Browse files
committed
Fix ui bug in wiki commit page
TODO: Maybe we should allow wiki to have its own ``.editorconfig`` file. Signed-off-by: a1012112796 <1012112796@qq.com>
1 parent e3b7198 commit 93c5c41

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/templates/helper.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,16 @@ func NewFuncMap() []template.FuncMap {
164164
mimeType := mime.TypeByExtension(filepath.Ext(filename))
165165
return strings.HasPrefix(mimeType, "image/")
166166
},
167-
"TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string {
167+
"TabSizeClass": func(ec interface{}, filename string) string {
168+
var (
169+
value *editorconfig.Editorconfig
170+
ok bool
171+
)
168172
if ec != nil {
169-
def, err := ec.GetDefinitionForFilename(filename)
173+
if value, ok = ec.(*editorconfig.Editorconfig); !ok {
174+
return "tab-size-8"
175+
}
176+
def, err := value.GetDefinitionForFilename(filename)
170177
if err != nil {
171178
log.Error("tab size class: getting definition for filename: %v", err)
172179
return "tab-size-8"

0 commit comments

Comments
 (0)