class Rouge::Formatters::HTMLLineHighlighter
def initialize(delegate, opts = {})
def initialize(delegate, opts = {}) @delegate = delegate @highlight_line_class = opts.fetch(:highlight_line_class, 'hll') @highlight_lines = opts[:highlight_lines] || [] end
def stream(tokens)
def stream(tokens) token_lines(tokens).with_index(1) do |line_tokens, lineno| line = %(#{@delegate.format(line_tokens)}\n) line = %(<span class="#{@highlight_line_class}">#{line}</span>) if @highlight_lines.include? lineno yield line end end