Method: Rouge::Formatters::HTMLLineTable#initialize

Defined in:
lib/rouge/formatters/html_line_table.rb

#initialize(formatter, opts = {}) ⇒ HTMLLineTable

Returns a new instance of HTMLLineTable.

Parameters:

  • formatter (Rouge::Formatters::Formatter)

    An instance of a Rouge::Formatters::HTML or Rouge::Formatters::HTMLInline

  • opts (Hash) (defaults to: {})

    options for HTMLLineTable instance.

Options Hash (opts):

  • :start_line (Integer)

    line number to start from. Defaults to 1.

  • :table_class (String)

    Class name for the table. Defaults to ‘“rouge-line-table”`.

  • :line_id (String)

    a sprintf template for generating an id attribute for each table row corresponding to current line number. Defaults to ‘“line-%i”`.

  • :line_class (String)

    Class name for each table row. Defaults to ‘“lineno”`.

  • :gutter_class (String)

    Class name for rendered line-number cell. Defaults to ‘“rouge-gutter”`.

  • :code_class (String)

    Class name for rendered code cell. Defaults to ‘“rouge-code”`.



24
25
26
27
28
29
30
31
32
# File 'lib/rouge/formatters/html_line_table.rb', line 24

def initialize(formatter, opts={})
  @formatter    = formatter
  @start_line   = opts.fetch :start_line,   1
  @table_class  = opts.fetch :table_class,  'rouge-line-table'
  @gutter_class = opts.fetch :gutter_class, 'rouge-gutter'
  @code_class   = opts.fetch :code_class,   'rouge-code'
  @line_class   = opts.fetch :line_class,   'lineno'
  @line_id      = opts.fetch :line_id,      'line-%i'
end