summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2019-08-09 16:29:13 +0000
committerBob Van Landuyt <bob@gitlab.com>2019-08-09 16:29:13 +0000
commite0e6e9e7dbcff3ce9ea12fb0421704d7ef48ad15 (patch)
treecd2cf6845f770c753a9e92d0706d897786bbfc99 /lib
parent42ccb425a4bf05d067e07f6e5c7e096ab87e5cb5 (diff)
parent6d318af5f95cc4091b09f1b2f8ed9981f3a8b9c7 (diff)
downloadgitlab-ce-e0e6e9e7dbcff3ce9ea12fb0421704d7ef48ad15.tar.gz
Merge branch 'revert-d61dab91' into 'master'
Revert "Merge branch '65152-selective-highlight' into 'master'" See merge request gitlab-org/gitlab-ce!31643
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/highlight.rb11
-rw-r--r--lib/rouge/formatters/html_gitlab.rb4
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb
index 1f49a26f0a2..381f1dd4e55 100644
--- a/lib/gitlab/highlight.rb
+++ b/lib/gitlab/highlight.rb
@@ -6,16 +6,15 @@ module Gitlab
TIMEOUT_FOREGROUND = 3.seconds
MAXIMUM_TEXT_HIGHLIGHT_SIZE = 1.megabyte
- def self.highlight(blob_name, blob_content, since: nil, language: nil, plain: false)
- new(blob_name, blob_content, since: since, language: language)
+ def self.highlight(blob_name, blob_content, language: nil, plain: false)
+ new(blob_name, blob_content, language: language)
.highlight(blob_content, continue: false, plain: plain)
end
attr_reader :blob_name
- def initialize(blob_name, blob_content, since: nil, language: nil)
+ def initialize(blob_name, blob_content, language: nil)
@formatter = Rouge::Formatters::HTMLGitlab
- @since = since
@language = language
@blob_name = blob_name
@blob_content = blob_content
@@ -54,13 +53,13 @@ module Gitlab
end
def highlight_plain(text)
- @formatter.format(Rouge::Lexers::PlainText.lex(text), since: @since).html_safe
+ @formatter.format(Rouge::Lexers::PlainText.lex(text)).html_safe
end
def highlight_rich(text, continue: true)
tag = lexer.tag
tokens = lexer.lex(text, continue: continue)
- Timeout.timeout(timeout_time) { @formatter.format(tokens, tag: tag, since: @since).html_safe }
+ Timeout.timeout(timeout_time) { @formatter.format(tokens, tag: tag).html_safe }
rescue Timeout::Error => e
Gitlab::Sentry.track_exception(e)
highlight_plain(text)
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb
index 0d4ac504428..e2a7d3ef5ba 100644
--- a/lib/rouge/formatters/html_gitlab.rb
+++ b/lib/rouge/formatters/html_gitlab.rb
@@ -8,8 +8,8 @@ module Rouge
# Creates a new <tt>Rouge::Formatter::HTMLGitlab</tt> instance.
#
# [+tag+] The tag (language) of the lexer used to generate the formatted tokens
- def initialize(tag: nil, since: nil)
- @line_number = since || 1
+ def initialize(tag: nil)
+ @line_number = 1
@tag = tag
end