summaryrefslogtreecommitdiffstats
path: root/modules/highlight
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2017-05-20 00:52:35 -0300
committerLunny Xiao <xiaolunwen@gmail.com>2017-05-20 11:52:35 +0800
commitbe5323a05fed04ede6dd7d0ca1f8ac3476536906 (patch)
tree8a9cfb2bb664ad9d7cc2c88ea5a9970ee3aee9d4 /modules/highlight
parent80cea8747fe87db98a9e930da6d664a245e5fc12 (diff)
downloadgitea-be5323a05fed04ede6dd7d0ca1f8ac3476536906.tar.gz
gitea-be5323a05fed04ede6dd7d0ca1f8ac3476536906.zip
Update HighlightJS and fix YAML files highlighting (#1764)
* Update HighlightJS to 9.11.0 * Fix YAML files highlighting
Diffstat (limited to 'modules/highlight')
-rw-r--r--modules/highlight/highlight.go70
1 files changed, 36 insertions, 34 deletions
diff --git a/modules/highlight/highlight.go b/modules/highlight/highlight.go
index 39b5d6d153..c3b504dfb4 100644
--- a/modules/highlight/highlight.go
+++ b/modules/highlight/highlight.go
@@ -25,39 +25,41 @@ var (
}
// Extensions that are same as highlight classes.
- highlightExts = map[string]bool{
- ".arm": true,
- ".as": true,
- ".sh": true,
- ".cs": true,
- ".cpp": true,
- ".c": true,
- ".css": true,
- ".cmake": true,
- ".bat": true,
- ".dart": true,
- ".patch": true,
- ".elixir": true,
- ".erlang": true,
- ".go": true,
- ".html": true,
- ".xml": true,
- ".hs": true,
- ".ini": true,
- ".json": true,
- ".java": true,
- ".js": true,
- ".less": true,
- ".lua": true,
- ".php": true,
- ".py": true,
- ".rb": true,
- ".scss": true,
- ".sql": true,
- ".scala": true,
- ".swift": true,
- ".ts": true,
- ".vb": true,
+ highlightExts = map[string]struct{}{
+ ".arm": {},
+ ".as": {},
+ ".sh": {},
+ ".cs": {},
+ ".cpp": {},
+ ".c": {},
+ ".css": {},
+ ".cmake": {},
+ ".bat": {},
+ ".dart": {},
+ ".patch": {},
+ ".elixir": {},
+ ".erlang": {},
+ ".go": {},
+ ".html": {},
+ ".xml": {},
+ ".hs": {},
+ ".ini": {},
+ ".json": {},
+ ".java": {},
+ ".js": {},
+ ".less": {},
+ ".lua": {},
+ ".php": {},
+ ".py": {},
+ ".rb": {},
+ ".scss": {},
+ ".sql": {},
+ ".scala": {},
+ ".swift": {},
+ ".ts": {},
+ ".vb": {},
+ ".yml": {},
+ ".yaml": {},
}
// Extensions that are not same as highlight classes.
@@ -85,7 +87,7 @@ func FileNameToHighlightClass(fname string) string {
}
ext := path.Ext(fname)
- if highlightExts[ext] {
+ if _, ok := highlightExts[ext]; ok {
return ext[1:]
}