7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# 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]
@formatter = Rouge::Formatters::HTMLLinewise.new(@formatter, class:'line-%i') if opts[:line_numbers_div]
if opts.fetch(:wrap, true)
css_class = opts.fetch(:css_class, 'codehilite')
if opts[:extra_css_classes] && !opts[:extra_css_classes].empty?
= opts[:extra_css_classes].is_a?(Array) ? opts[:extra_css_classes] : opts[:extra_css_classes].to_s.split
css_class = [css_class].concat().join(' ')
end
@formatter = Rouge::Formatters::HTMLPygments.new(@formatter, css_class)
end
end
|