From: FlorianBen Date: Sun, 4 Aug 2019 08:11:27 +0000 (+0200) Subject: Fix specific highlighting (CMakeLists.txt ...) (#7686) X-Git-Tag: v1.10.0-rc1~302 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0e887af2d16740798a1ced5f6af0b58bd070c40b;p=gitea.git Fix specific highlighting (CMakeLists.txt ...) (#7686) * Fix specific highlighting. * Highlighting CMakeLists.txt: remove case sensitive checks. use lowercase checks instead. --- diff --git a/modules/highlight/highlight.go b/modules/highlight/highlight.go index cb52f6ac2e..4334480566 100644 --- a/modules/highlight/highlight.go +++ b/modules/highlight/highlight.go @@ -19,9 +19,11 @@ var ( } // File names that are representing highlight classes. - highlightFileNames = map[string]bool{ - "dockerfile": true, - "makefile": true, + highlightFileNames = map[string]string{ + "dockerfile": "dockerfile", + "makefile": "makefile", + "gnumakefile": "makefile", + "cmakelists.txt": "cmake", } // Extensions that are same as highlight classes. @@ -87,8 +89,8 @@ func FileNameToHighlightClass(fname string) string { return "nohighlight" } - if highlightFileNames[fname] { - return fname + if name, ok := highlightFileNames[fname]; ok { + return name } ext := path.Ext(fname)