]> source.dussan.org Git - gitea.git/commitdiff
Fix specific highlighting (CMakeLists.txt ...) (#7686)
authorFlorianBen <FlorianBen@users.noreply.github.com>
Sun, 4 Aug 2019 08:11:27 +0000 (10:11 +0200)
committerLunny Xiao <xiaolunwen@gmail.com>
Sun, 4 Aug 2019 08:11:27 +0000 (16:11 +0800)
* Fix specific highlighting.

* Highlighting CMakeLists.txt:
remove case sensitive checks.
use lowercase checks instead.

modules/highlight/highlight.go

index cb52f6ac2ea9e759f09d143657b62f94c066f09d..4334480566f7c955bbd3bce2b35a20b4afdc030c 100644 (file)
@@ -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)