Loading app/helpers/blob_helper.rb 0 → 100644 +18 −0 Original line number Diff line number Diff line module BlobHelper def highlightjs_class(blob_name) if blob_name.include?('.') ext = blob_name.split('.').last return 'language-' + ext else if no_highlight_files.include?(blob_name.downcase) 'no-highlight' else blob_name.downcase end end end def no_highlight_files %w(credits changelog copying copyright license authors) end end app/views/shared/_file_hljs.html.haml +1 −1 Original line number Diff line number Diff line Loading @@ -8,5 +8,5 @@ = i .highlight %pre %code %code{ class: highlightjs_class(blob.name) } = blob.data Loading
app/helpers/blob_helper.rb 0 → 100644 +18 −0 Original line number Diff line number Diff line module BlobHelper def highlightjs_class(blob_name) if blob_name.include?('.') ext = blob_name.split('.').last return 'language-' + ext else if no_highlight_files.include?(blob_name.downcase) 'no-highlight' else blob_name.downcase end end end def no_highlight_files %w(credits changelog copying copyright license authors) end end
app/views/shared/_file_hljs.html.haml +1 −1 Original line number Diff line number Diff line Loading @@ -8,5 +8,5 @@ = i .highlight %pre %code %code{ class: highlightjs_class(blob.name) } = blob.data