2018-09-06 05:48:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class BlobPresenter < Gitlab::View::Presenter::Simple
|
|
|
|
presents :blob
|
|
|
|
|
|
|
|
def highlight(plain: nil)
|
2018-10-04 00:04:13 -04:00
|
|
|
blob.load_all_data! if blob.respond_to?(:load_all_data!)
|
|
|
|
|
2018-09-06 05:48:57 -04:00
|
|
|
Gitlab::Highlight.highlight(
|
|
|
|
blob.path,
|
|
|
|
blob.data,
|
|
|
|
language: blob.language_from_gitattributes,
|
2018-09-11 00:37:44 -04:00
|
|
|
plain: plain
|
2018-09-06 05:48:57 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|