summaryrefslogtreecommitdiff
path: root/lib/rouge
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-06-15 12:08:04 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2016-07-14 10:08:15 -0700
commit504a048b0824aecb81faa3ca4a9503a05c93faac (patch)
tree9e3340e1363477daae937c440fe781b222452774 /lib/rouge
parent96274c2765ad4daa23af667b27dc647a3406d7c0 (diff)
downloadgitlab-ce-504a048b0824aecb81faa3ca4a9503a05c93faac.tar.gz
remove the dead linenos and linenostart options
and the methods that relied on them
Diffstat (limited to 'lib/rouge')
-rw-r--r--lib/rouge/formatters/html_gitlab.rb46
1 files changed, 2 insertions, 44 deletions
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb
index 04943c173bd..b76021eef77 100644
--- a/lib/rouge/formatters/html_gitlab.rb
+++ b/lib/rouge/formatters/html_gitlab.rb
@@ -9,14 +9,6 @@ module Rouge
#
# [+cssclass+] CSS class for the wrapping <tt><div></tt> tag
# (default: 'highlight').
- # [+linenos+] If set to 'table', output line numbers as a table
- # with two cells, one containing the line numbers,
- # the other the whole code. This is copy paste friendly,
- # but may cause alignment problems with some browsers
- # or fonts. If set to 'inline', the line numbers will
- # be integrated in the <tt><pre></tt> tag that contains
- # the code (default: nil).
- # [+linenostart+] The line number for the first line (default: 1).
# [+lineanchors+] If set to true the formatter will wrap each output
# line in an anchor tag with a name of L-linenumber.
# This allows easy linking to certain lines
@@ -26,53 +18,23 @@ module Rouge
# (default: 'L').
def initialize(
cssclass: 'highlight',
- linenos: nil,
- linenostart: 1,
lineanchors: false,
lineanchorsid: 'L'
)
@cssclass = cssclass
- @linenos = linenos
- @linenostart = linenostart
@lineanchors = lineanchors
@lineanchorsid = lineanchorsid
end
def render(tokens)
- case @linenos
- when 'table'
- render_tableized(tokens)
- when 'inline'
- render_untableized(tokens)
- else
- render_untableized(tokens)
- end
- end
-
- alias_method :format, :render
-
- private
-
- def render_untableized(tokens)
data = process_tokens(tokens)
wrap_lines(data[:code])
end
- def render_tableized(tokens)
- data = process_tokens(tokens)
+ alias_method :format, :render
- html = ''
- html << '<table><tbody>'
- html << "<td class=\"linenos\"><pre>"
- html << wrap_linenos(data[:numbers])
- html << '</pre></td>'
- html << "<td class=\"lines\"><pre><code>"
- html << wrap_lines(data[:code])
- html << '</code></pre></td>'
- html << '</tbody></table>'
- html
- end
+ private
def process_tokens(tokens)
rendered = []
@@ -101,10 +63,6 @@ module Rouge
{ numbers: numbers, code: rendered }
end
- def wrap_linenos(numbers)
- numbers.join("\n")
- end
-
def wrap_lines(lines)
if @lineanchors
lines = lines.each_with_index.map do |line, index|