Sha256: 5e530637656da0d070553b258c5004d00b7d013a6888b92885f9d37d1d75aafb

Contents?: true

Size: 894 Bytes

Versions: 2

Compression:

Stored size: 894 Bytes

Contents

module Middleman
  module Syntax
    module Formatters
      class HTML < Rouge::Formatter
        tag 'html'

        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]
        
          @formatter = Rouge::Formatters::HTMLLinewise.new(@formatter, class:'line-%i') if opts[:line_numbers_div]

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-syntax-3.4.0 lib/middleman-syntax/formatters.rb
middleman-syntax-3.3.0 lib/middleman-syntax/formatters.rb