summaryrefslogtreecommitdiff
path: root/lib/rouge
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-28 18:14:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-28 18:14:18 +0000
commitb267f3a3acf3fe4cf2a9bb254d7abeb3b2823b21 (patch)
treea1c30c9a460a1c990311d47aae72d00368e1a1c1 /lib/rouge
parent03cd4f8da4f848c7dfd0c0b88b4c095f69e56bb0 (diff)
downloadgitlab-ce-b267f3a3acf3fe4cf2a9bb254d7abeb3b2823b21.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/rouge')
-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