Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r--app/models/snippet.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 0a54fee7e2f..119b69a4525 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -1,4 +1,6 @@
class Snippet < ActiveRecord::Base
+ include Utils::Colorize
+
belongs_to :project
belongs_to :author, :class_name => "User"
has_many :notes, :as => :noteable
@@ -28,6 +30,11 @@ class Snippet < ActiveRecord::Base
".js", ".sh", ".coffee", ".yml", ".md"
]
end
+
+ def colorize
+ ft = handle_file_type(file_name)
+ Albino.colorize(content, ft, :html, 'utf-8', "linenos=True")
+ end
end
# == Schema Information
#