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 'lib/rouge/formatters/html_gitlab.rb')
-rw-r--r--lib/rouge/formatters/html_gitlab.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb
index e0e9677fac7..9e76225fc54 100644
--- a/lib/rouge/formatters/html_gitlab.rb
+++ b/lib/rouge/formatters/html_gitlab.rb
@@ -21,12 +21,24 @@ module Rouge
is_first = false
yield %(<span id="LC#{@line_number}" class="line" lang="#{@tag}">)
- line.each { |token, value| yield span(token, value.chomp! || value) }
+
+ line.each do |token, value|
+ yield highlight_unicode_control_characters(span(token, value.chomp! || value))
+ end
+
yield %(</span>)
@line_number += 1
end
end
+
+ private
+
+ def highlight_unicode_control_characters(text)
+ text.gsub(Gitlab::Unicode::BIDI_REGEXP) do |char|
+ %(<span class="unicode-bidi has-tooltip" data-toggle="tooltip" title="#{Gitlab::Unicode.bidi_warning}">#{char}</span>)
+ end
+ end
end
end
end