Method: CodeRay::Encoders::HTML2#line_attr

Defined in:
lib/milkode/cdweb/lib/coderay_html2.rb

#line_attr(line, no, options) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/milkode/cdweb/lib/coderay_html2.rb', line 59

def line_attr(line, no, options)
  # p options
  is_highlight = true if options[:highlight_lines].include?(no)

  r = []
  r << "id=\"n#{no}\""
  r << "class=\"highlight-line\"" if is_highlight
  attr = r.join(" ")

  line = Milkode::Util::highlight_keywords(line, options[:keywords], 'highlight-filename') if is_highlight
  
  "<span #{attr}>#{line}</span>"
end