Skip to content

Commit

Permalink
Fix specific highlighting (CMakeLists.txt ...) (go-gitea#7686)
Browse files Browse the repository at this point in the history
* Fix specific highlighting.

* Highlighting CMakeLists.txt:
remove case sensitive checks.
use lowercase checks instead.
  • Loading branch information
FlorianBen authored and lunny committed Aug 4, 2019
1 parent 09463d1 commit 0e887af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modules/highlight/highlight.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0e887af

Please sign in to comment.