Commit 0d13abb1c8d527f2a6e6b97e34899e9b35f264bc
1 parent
ab094e67
Exists in
spb-stable
and in
2 other branches
Specify language detection for highlight.js
Because I am tired of CHANGELOG highlighted as sql file :) Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
19 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +module BlobHelper | ||
2 | + def highlightjs_class(blob_name) | ||
3 | + if blob_name.include?('.') | ||
4 | + ext = blob_name.split('.').last | ||
5 | + return 'language-' + ext | ||
6 | + else | ||
7 | + if no_highlight_files.include?(blob_name.downcase) | ||
8 | + 'no-highlight' | ||
9 | + else | ||
10 | + blob_name.downcase | ||
11 | + end | ||
12 | + end | ||
13 | + end | ||
14 | + | ||
15 | + def no_highlight_files | ||
16 | + %w(credits changelog copying copyright license authors) | ||
17 | + end | ||
18 | +end |