summaryrefslogtreecommitdiff
path: root/lib/rouge
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-03-10 15:34:29 -0600
committerDouwe Maan <douwe@selenight.nl>2017-03-14 15:29:00 -0600
commit6890327762eaeca572ada783804a9c7af01e6144 (patch)
tree7b02bf428e349024ffa755ea1d7bd4e807e1821c /lib/rouge
parentb716680692b4d5f7565e29e8fbd1737d24cbf658 (diff)
downloadgitlab-ce-6890327762eaeca572ada783804a9c7af01e6144.tar.gz
Copy code as GFM from diffs, blobs and GFM code blocks
Diffstat (limited to 'lib/rouge')
-rw-r--r--lib/rouge/formatters/html_gitlab.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb
index 4edfd015074..ec95ddf03ea 100644
--- a/lib/rouge/formatters/html_gitlab.rb
+++ b/lib/rouge/formatters/html_gitlab.rb
@@ -6,9 +6,10 @@ module Rouge
# Creates a new <tt>Rouge::Formatter::HTMLGitlab</tt> instance.
#
# [+linenostart+] The line number for the first line (default: 1).
- def initialize(linenostart: 1)
+ def initialize(linenostart: 1, tag: nil)
@linenostart = linenostart
@line_number = linenostart
+ @tag = tag
end
def stream(tokens, &b)
@@ -17,7 +18,7 @@ module Rouge
yield "\n" unless is_first
is_first = false
- yield %(<span id="LC#{@line_number}" class="line">)
+ yield %(<span id="LC#{@line_number}" class="line" lang="#{@tag}">)
line.each { |token, value| yield span(token, value.chomp) }
yield %(</span>)