Skip to content

Commit 8f64017

Browse files
a1012112796lunnyzeripath
authored
Fix ui bug in wiki commit page (#12089) (#12125)
* Fix ui bug in wiki commit page TODO: Maybe we should allow wiki to have its own ``.editorconfig`` file. Signed-off-by: a1012112796 <[email protected]> * fix a small nit Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: zeripath <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent d737eaa commit 8f64017

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/templates/helper.go

Lines changed: 9 additions & 2 deletions
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 || value == nil {
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)