Class: Middleman::Syntax::Formatters::HTML

Inherits:
Rouge::Formatter
  • Object
show all
Defined in:
lib/middleman-syntax/formatters.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ HTML

Returns a new instance of HTML.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/middleman-syntax/formatters.rb', line 7

def initialize(opts={})
  @formatter = if opts[:inline_theme]
                 Rouge::Formatters::HTMLInline.new(opts[:inline_theme])
               else
                 Rouge::Formatters::HTML.new
               end

  @formatter = Rouge::Formatters::HTMLTable.new(@formatter, opts) if opts[:line_numbers]

  if opts.fetch(:wrap, true)
    @formatter = Rouge::Formatters::HTMLPygments.new(@formatter, opts.fetch(:css_class, 'codehilite'))
  end
end

Instance Method Details

#stream(tokens, &block) ⇒ Object



21
22
23
# File 'lib/middleman-syntax/formatters.rb', line 21

def stream(tokens, &block)
  @formatter.stream(tokens, &block)
end